validator vs validation in 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
Rule::unique('users')->ignore($user->id, 'user_id')