laravel login with email code example

Example 1: login with email and phone laravel

protected function credentials(Request $request)
        {
          if(is_numeric($request->get('email'))){
            return ['phone'=>$request->get('email'),'password'=>$request->get('password')];
          }
          elseif (filter_var($request->get('email'), FILTER_VALIDATE_EMAIL)) {
            return ['email' => $request->get('email'), 'password'=>$request->get('password')];
          }
          return ['username' => $request->get('email'), 'password'=>$request->get('password')];
        }

Example 2: log email laravel

This is in your Mail.php config file...

When using
  
'driver' => env('MAIL_DRIVER', 'log'),

This will get the MAIL_DRIVER environment variable set in your .env file. In
this case, 'log' is used only as a default if a value is not specified in your.
env file... Your .env file probably has this still set in it. set it to log.

MAIL_DRIVER=smtp
  
#### replace with ####

MAIL_DRIVER=log

Tags:

Php Example