Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

siddhraj's avatar

Save Session In Two Different Database table one for admin_session and other is user_session

i want to use 2 tables for sessions. i have an admin area, and i have a front-end area. both require login. i want admin area to use admin_sessions table, while i want front-end area to use user_sessions table. Also, i want to limit front-end area so that a user can only have limited logins at one time.

0 likes
2 replies
D9705996's avatar

For limiting concurrent sessions you could use

Auth::logoutOtherDevices($password);

https://laravel.com/docs/5.7/authentication#invalidating-sessions-on-other-devices

If you call this function it invalidates all other sessions so you could limit users to one concurrent login.

Why do you want to use separate session tables for user and admin ? This isn't supported out of the box so your most likely going to write a custom session driver.

https://laravel.com/docs/5.7/session#adding-custom-session-drivers

It's an unusual requirement so if you can explain in more detail we might identify a better solution.

siddhraj's avatar

Thanks @D9705996 Right now i have 2 different users table one for admin and other for enduser i.e user

Admin user have to restrict enduser to maximum login only 5 at a time. if end user try to login as more than 5 session than i have to throw error message as you have reach parallel login session . please logout from any of the system and try again.

Please or to participate in this conversation.