if validation fails 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
Validator::extend('foo', 'FooValidator@validate');