email verification in laravel code example

Example 1: email validation in laravel

'email' => 'required|email|unique:users,email',
//@sujay

Example 2: email validation in laravel

'user.email' => 'required|email|unique:users,email,'.$user->id,
//@sujay

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()) {
        // an admin
        $redirect = '/admin';
    } elseif ($user->manager()) {
        // it's a manager
        $redirect = '/manager/home';
    } else {
        // it's a user
        $redirect = '/dashboard';
    }
    return redirect($redirect);
}