i don't know why you want to connect as a user. Not to mentionn that in this case you have to know his password what a no go.
As admin you have access to the database with all data. So why don't you just make a query and fetch all data of the user?
Hello,
I have a admin panel with a list of users. When i click on the username of a user, i need to open his own page (with his information).
Actually, i loggin as user and i can perform necessary operations but everytime i loggin as a user i am disconnected from my admin panel.
Actually i use the part of code to log me in as user. Do you know a other solution to keep my admin panel active and open Users pages as the user see it ?
Thank You
public function connectAsUser($id)
{
if (Auth::loginUsingId($id))
{
return redirect()->intended('/home');
}
else
{
return 'ERROR';
}
}
@visualight You could store your (admin) user id in a session when changing to a users scenario and add a button like "Return back to admin panel". When clicking this you can do something like Auth::loginUsingId(Session::get(
Best of luck!
Please or to participate in this conversation.