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

cecosd's avatar

Separate session for one user logged with different guards

Hello to all,

When an user is logged in as one guard and tries to login with another with the same account email/username, the first guard session is being destroyed and the user is logged out from the first guard.

How can I separate the sessions for the two guards

0 likes
5 replies
Guru5005's avatar
Guru5005
Best Answer
Level 3

The answer for your question is already there in your question it self. What i mean is , when you say different guards it means two separate database, and two separate sessions are maintained in the application. You are saying that you are logging in the user with one table and different guards? i dont think it makes any sense. why do you need different guard for single user ?

cecosd's avatar

@GURUR - So you are saying it's better to have different table for users and admins? Is this the better practice

Guru5005's avatar

@CECOSD - I would go for only 1 guard and will have type of user column in the database to differentiate user and admin

Please or to participate in this conversation.