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
lazydogOP6mo ago
I've done this in testing, using Filament::setTenant but not yet done in actual switching
awcodes
awcodes6mo ago
It should be automatic on the switch. You can access it with Filament::getCurrentTenant() iirc
lazydog
lazydogOP6mo 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
jaocero6mo ago
use Filament::getTenant()
lazydog
lazydogOP6mo ago
Yes you are correct but needs to set/update Tenant first using setTenant.
jaocero
jaocero6mo ago
It show be done automatically not by setting the tenant Once you switch to different tenants it will also updates the current tenant
Want results from more Discord servers?
Add your server