raviawasti's avatar

How can i login/access user account from admin panel in laravel?

How to implement secret login from admin panel to user account..

0 likes
5 replies
carpad88's avatar

You could make a specific route, controller and view for the admin section, for that you also need to create an admin role or something like that so only users with that role can log in to the admin section.

I've used a kind of CMS on top of laravel that resolves that problem if you don't want to make all the logic from scratch voyager.

fylzero's avatar

It sounds like @raviawasti wants to make a super user area to impersonate users?

You can scope a users role... make a super user route /super... create middleware to protect that route so that only a user with super admin role can access that route... then build out a user table that has buttons for impersonation. Those would just use Auth::loginUsingId(1) behind the scenes.

The "secret" part is basically just to not link to the route anywhere in your app. Just hit it directly... I would also setup your app to disallow search engines from listing that page as well.

Hope this helps.

24 likes

Please or to participate in this conversation.