@shivkhaira Don’t use separate tables just for the sake of different roles. Just store roles against your users and then use them to determine what they can and cannot do in your application. I go into this in more depth here: https://martinbean.dev/blog/2021/07/29/simple-role-based-authentication-laravel/
Being able to log in as any member is called user impersonation. You will need an endpoint (that is really secure) that puts the current user ID in the session, and then authenticates you in as the target user. It can be as simple as:
$request->session()->flush();
// Save ID of current user (admin) in session
$request->session()->impersonator($request->user()->getKey());
// Now log in as requested user
Auth::loginUsingId($userId);
Put a banner at the top of the site saying “Impersonating [user name]” just so no one forgets and starts doing things whilst logged in as that user such as submitting content, placing orders, etc.
To stop impersonating, have another endpoint that re-authenticates the original user if one exists in the session:
// Get original user ID before session is regenerated
$userId = $request->session()->pull('impersonator');
// If there was no impersonator in session,
// user is maybe trying to do something they shouldn’t
if ($userId === null) {
Auth::logout();
return redirect()->to('/');
}
$request->session()->flush();
// Restore admin session
Auth::loginUsingId($userId);