Answer the question
In order to leave comments, you need to log in
How to make authorization by login and email?
How to make it possible to log in both by login and by email?
laravel6.x
use AuthenticatesUsers;
protected $redirectTo = RouteServiceProvider::HOME;
public function __construct()
{
$this->middleware('guest')->except('logout');
}
Answer the question
In order to leave comments, you need to log in
Did you throw this piece of code here as an example of "I tried, but it didn't work" ?
Well, let's spread our brains together. You have the AuthenticatesUsers
trait
. You need to copy the username method from it to your controller. Now he is like this
public function username()
{
return 'email';
}
public function username()
{
// вот тут ты должен выполнить проверку что пришло и в зависимости от этого сделать return название столбца email или name
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question