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

Pozitiveman's avatar

Multiple Logged In users

I have specific need to have multiple logged in users. By the term "user" I mean authenticated user through some kind of credentials (email/password, SSO, etc.). Similar to Google/Facebook but with the difference that user does not switch between users/accounts, but works with several logged in users at the same time.

I was thinking just adding second user id to the first logged session, but then will be having issues with almost everything standard like Auth::id(), pivot tables, API tokens and etc.

Has anyone had similar requirements.

0 likes
5 replies
Yorki's avatar

You still need the custom solution anyway. Like you can't just query where user_id=? if you have multiple users logged in. Depends on your project needs, but maybe something like account is what you need. Like one user can have multiple accounts assigned to it. Then in most cases you would'nt need to care about account ids, but the user id.

Pozitiveman's avatar

@Yorki The main purpose of multiple users in my case is the ability to have access to different data that is accessible through different auth credentials. That's actually the only purpose. So in this case different account (profiles) with one user id will not work. Although users will have accounts under User(auth).

Pozitiveman's avatar

@benjamin1509 Yes, but multi-tenant usually uses one user id (auth credentials) and then tenants are attached to that users. We are trying is to merge multiple authenticated users in one session. So the question are there some elegant ways to do it, rather than just hacking the standard Laravel User model and session.

Please or to participate in this conversation.