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

oussamanm's avatar

how to configure : Laravel with Multi tenancy in one domain with Authentification

Please, if anyone has managed to create a SaaS project using Laravel and Multi-Tenancy (one domain instead of a subdomain, e.g., app.domainname.com) with Authentication, I need some advice. I have managed to read and watch some tutorials, but I'm still really confused about how to implement it.

I'm now at the point : where I have created the project and installed the Stancl\Tenancy package. I have done the first basic configuration, and I also have an idea to create a CentralUser table in the central database. It will have (tenant_id, email). The objective of this table is that every time a user logs in, I will know which tenant database I should connect them to. In every Tenant, there will be a Users table that will have user data (email, password, etc.).

  • Will this approach really work?
  • If the user is logged in, how do I make them only connected to their database?
0 likes
4 replies
oussamanm's avatar

@vincent15000 the serie you gived me is talking about Single Database, my project need multi-database

1 like

Please or to participate in this conversation.