Created
January 2, 2018 11:06
-
-
Save anonymous/235b0c4929a000c880cde30ef0d29d64 to your computer and use it in GitHub Desktop.
Constant expression contains invalid operations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected $rules = array( | |
'brand'=>'required', | |
'model'=>'required', | |
'source'=>'required', | |
'name'=>'required|string|min:3|max:255', | |
'email'=>['nullable','email','max:255',new EmailValidator()],// this line is causing error | |
'phone'=>'required|digits_between:10,15', | |
'alt_phone'=>'nullable|digits_between:10,15', | |
'address'=>'required|string|min:3', | |
'description'=>'required|string|min:3', | |
'state'=>'required', | |
'city'=>'required', | |
'follow_date'=>'required|date|after:today', | |
'visit_date'=>'required|date|after:today', | |
); | |
//Validation | |
public function store(Request $request){ | |
$lead = new Lead; | |
if ($lead->validate($request->all())) { | |
$request->request->add([ | |
'created_by' => Auth::user()->id, | |
'follow_date' =>date('Y-m-d', strtotime($request->follow_date)), | |
'visit_date' =>date('Y-m-d', strtotime($request->visit_date)), | |
'state'=>state::where('id',$request->state)->first()->name | |
]); | |
Lead::create($request->except('_token')); | |
} else { | |
return back()->withErrors($lead->errors())->withInput($request->all()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment