Answer the question
In order to leave comments, you need to log in
How to make user authorization if the data is stored in different tables?
Hello.
There is a User table, it contains a name, mail, password, almost everything you need. But there is also a User_info table in which the phone is stored. It is necessary to make authorization by phone and password.
How can I do that?
Answer the question
In order to leave comments, you need to log in
By phone, we look for the user id in the User_info table, and then we check the correctness of the password from the User table.
$userInfo = UserInfo::where('phone', $request->get('phone', ''))->firstOrFail();
$user = User::findOrFail($userInfo->user_id);
if(\Hash::check($request->get('password', ''), $user->password))
{
auth()->login($user, true);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question