I want to authenticate a user based upon the credentials which is in one database and date of birth which is in another database. I have searched for customization but what i just found is, customization using only one database and its table. Wasn't of much help to me
1 Answer
You can query the two databases manually and then log in the user yourself.
For example:
$user = User::where(['email' => $email, 'password' => $password])->first();
$userSecondDb = UserSecondDb::where(['id' => $user->id, 'dateofbirth' => $dateofbirth])->first();
if (isset($user) && isset($userSecondDb))
{
Auth::login($user);
}
2 Comments
Sharad Kumar
I am a newbee to laravel, Auth::login($user) does it mean defining a function login in the Auth. And another question is after login i want to hide or display menu partial views based upon user privilege value. for example: if privilege = 3 display all and if privilege = 0 just display basic menu!!!!! @ Jerodev
Sharad Kumar
And another thing do i need to do php artisan make:auth for this? I am not using it though. I am manually doing it. Please enlighten me!!!