validation in request laravel code example
Example 1: valdidate laravel if falid
$validator = Validator::make($request->all(), [
'name' => 'required|min:2|max:255'
]);
if ($validator->fails()) {
return view('view_name');
} else {
return view('view_name');
}
Example 2: laravel validation
"foo" => "Your input was invalid!",
"accepted" => "The :attribute must be accepted.",
// The rest of the validation error messages...