If your rules are dynamic and depend on some other condition, you can create that array of rules on the fly
public function store(Request $request){ $validationArray = [ 'title' => 'required', 'company' => 'required', 'logo' => 'file|max:2048', 'location' => 'required', 'apply_link' => 'required|url', 'content' => 'required', 'payment_method_id' => 'required' ]; if (!Auth::check()) { $validationArray = array_merge($validationArray, [ 'email' => 'required|email|unique:users', 'password' => 'required|confirmed|min:5', 'name' => 'required' ]); } //}