Multi Tenancy Setup Question
Hi All,
I'm trying to set up multi-tenancy where Business is the Tenant, and each Business can have multiple Teams. Users can belong to multiple Teams, and regular members should only see their team's data. Admins can see all teams and manage the business info.
I'm confused because it feels like both Business and Team could be treated as tenants. Should I make Teams the tenant and manage roles per user? Or should I stick with Business as the tenant and handle the Team's information with custom scopes/observers with roles/permissions inside the team - what I am leaning towards... This way I can have 2 panels. The BusinessPanel and TeamPanel?
Thanks for any guidance!
Solution:Jump to solution
Unless there is a need for many users to many businesses, then my first avenue would be to have the Teams as tenant. Then have Teams & Users belonging to Business which can limit the tenant a user can opt for. You can avoid slug\url requirements.
But either way, it won't take long to build a wireframe with multiple solutions and test them out....
4 Replies
Difficult to assess without knowing the full scope of your app.
Also depends on your database structure, but since you want many to many on users\teams, and presumably only one business per user, then Teams as the tenant and Business controlled by global scope on the teams would be the first way I'd look at it.
Thank you for your answer. What if you want to go has many (business many users) Would you still go as Team the Tenant?
There is no structure yet - its a new app I am starting with - so busy brainstorming π
I was thinking setup BusinessPanel and TeamPanel - each being 'tenants' - Not sure if filament supports that out of the box.
So the url can then be /business/1 -- manage business/teams, etc
/business/1/team/1 -- the teams information here...
So the user can switch between teams under /business/1.
And update the BusinessPanel tenant to only have one user (can only belong to 1 business)
Or I handle that myself with a middleware in the both panels to store it in the session. But yes - the other way might be multiple tenancy database setup. Them the subdomain is the business and TeamPanel is tenant - trying to avoid that if needed for the proof of concept...
Why I confused myself and hope some ideas/nudged in the more appropriate direction here...
Thanks!
Solution
Unless there is a need for many users to many businesses, then my first avenue would be to have the Teams as tenant. Then have Teams & Users belonging to Business which can limit the tenant a user can opt for. You can avoid slug\url requirements.
But either way, it won't take long to build a wireframe with multiple solutions and test them out.
Perfect. Thanks for that - yeah. Best will just be to set it up and see what feels comfortable. Thanks π