Understanding Multi-Tenant Architecture in Filament V3

Hello everyone, I'm currently working on a project using Filament V3 and I'm trying to get a clear understanding of how multi-tenancy is handled compared to something like Laravel Jetstream's Teams feature. My application involves a scenario where users can belong to multiple companies (tenants) and switch between them, similar to switching between teams in Jetstream. I'm exploring how to best design this multi-tenancy structure using Filament V3. Here are a few specific questions I have: 1. How does Filament V3 handle tenant switching in the database? Is there a recommended method to manage this process? 2. How does Filament register, switch, and apply the current tenant in its architecture? Is there any session or user property involved, or does it use a different mechanism? 3. How does the multi-tenancy design in Filament V3 compare to the Teams feature in Laravel Jetstream? Are there any key differences I should be aware of? 4. Any guidance or insights on this topic would be greatly appreciated, especially if you've implemented multi-tenancy in Filament V3 before. Thanks in advance for your help!
2 Replies
BKF Dev
BKF Dev12mo ago
+1
Ian Tasker
Ian Tasker12mo ago
1. There is a event for TenantSet which you can listen to to update the field on the user to store which tenant they are one. 2. Afaik Filement will use the tenant returned in getDefaultTenant as the current tenant. 3. I am at this point, so far I found no way to display users for a tenant using a relation manger or other method when using the existing Profile method. On point 3 it looks like it will need a custom page like breezy has for the user profile.