On our service there's admins and other users. I'm using the basic Laravel Auth package for handling registrations, logins etc.
What would be the best way to implement a feature, where an admin user could "fake login" as a regular user, without knowing the actual user's password?
This should work:
Auth::loginUsingId($userId, true);
There is a function in laravel Auth::loginUsingId()
:
if(Auth::loginUsingId($userId))
{
return redirect('/dashboard');
}
by which user can login by using its id
in user table only. In this there is no need to pass email
, password
etc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With