from where verification email is sent in default auth laravel code example
Example 1: laravel using username instead of email
All we need is add a method in app/Http/Controllers/Auth/LoginController.php:
public function username()
{
return 'username';
}
Example 2: username or email validation in laravel
$input = $request->only('account');
$rules = [
'account' => 'required'
];
if (filter_var($input['account'], FILTER_VALIDATE_EMAIL)) {
$rules['account'] .= '|exists:users,email';
} else {
$rules['account'] .= '|exists:users,username';
}
$messages = [
'account.required' => 'Enter username or email to login.',
];
$validator = Validator::make($input, $rules, $messages);