Now I\'ve followed the Laravel documentation on how to allow usernames during authentication, but it takes away the ability to use the email. I want to allow users to use their
Add this code to your login controller - Hope it will works. Reference login with email or username in one field
public function __construct()
{
$this->middleware('guest')->except('logout');
$this->username = $this->findUsername();
}
public function findUsername()
{
$login = request()->input('login');
$fieldType = filter_var($login, FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
request()->merge([$fieldType => $login]);
return $fieldType;
}
public function username()
{
return $this->username;
}