email verification in laravel code example
Example 1: email validation in laravel
'email' => 'required|email|unique:users,email',
Example 2: email validation in laravel
'user.email' => 'required|email|unique:users,email,'.$user->id,
Example 3: laravel check if email is real
<?php
$email = "[email protected]";
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo("$email is a valid email address");
} else {
echo("$email is not a valid email address");
}
?>
Example 4: verify type of account laravel
protected function authenticated(Request $request, User $user)
{
if ($user->admin()) {
$redirect = '/admin';
} elseif ($user->manager()) {
$redirect = '/manager/home';
} else {
$redirect = '/dashboard';
}
return redirect($redirect);
}