If your rules are dynamic and depend on some other condition, you can create that array of rules on the fly
1public function store(Request $request) 2{ 3 $validationArray = [ 4 'title' => 'required', 5 'company' => 'required', 6 'logo' => 'file|max:2048', 7 'location' => 'required', 8 'apply_link' => 'required|url', 9 'content' => 'required',10 'payment_method_id' => 'required'11 ];12 13 if (!Auth::check()) {14 $validationArray = array_merge($validationArray, [15 'email' => 'required|email|unique:users',16 'password' => 'required|confirmed|min:5',17 'name' => 'required'18 ]);19 }20 //21}