Filament Tenancy

I've implemented the default tenancy of Filament, user can create multiple team and switched. However, I can only get the default team (first create team only) when switching to other team, how can I set the newly selected tenant to be the current team?
6 Replies
lazydog
lazydog5w ago
I've done this in testing, using Filament::setTenant but not yet done in actual switching
awcodes
awcodes5w ago
It should be automatic on the switch. You can access it with Filament::getCurrentTenant() iirc
lazydog
lazydog5w ago
Undefined with Filament::getCurrentTenant(), what I've done, temporarily, I've created a helper function that sets current team using request()->tenant and find that tenant in my model via slug There is no such method getCurrentTenant() using Filament version '^3.2'
jaocero
jaocero5w ago
use Filament::getTenant()
lazydog
lazydog5w ago
Yes you are correct but needs to set/update Tenant first using setTenant.
jaocero
jaocero5w ago
It show be done automatically not by setting the tenant Once you switch to different tenants it will also updates the current tenant