I have a very weird problem. When I'm submitting the form, it throws an error with server-side validation.
BadMethodCallException
Method [validationRequired] does not exist.
My controller:
public function store(Request $request)
{
$rules = array(
'DateDebut' => 'required',
'TimeDebut' => 'required',
);
$messages = [
'DateDebut.required'=>'La date de début de réunion est obligatoire.',
'TimeDebut.required'=>'L\'heure de début de réunion est obligatoire.'
];
$validator = Validator::make($request->all(),$rules,$messages);
if ($validator->fails()) {
return redirect()->route('demandes.create')
->withErrors($validator->errors()->messages());
} else {
return view('demandes.index');
}
}
The controller fails on the methode $validator->fails()
$validatorwith thisdd($validator), you can also check the values you pass to the validator this way to see if you notice anything off. Last thing to check is if you have the correctValidatorin your codedd($validator')return a Validator object with all my data and all the rules . For the classValidatorit call the interface of laravel framework withuse Validatoron the top of the controller. @ArijitJana what did you expect when you said "web.php" ?Route::resource('demandes', 'RequestController');