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
lazydogOP7mo ago
I've done this in testing, using Filament::setTenant but not yet done in actual switching
awcodes
awcodes7mo ago
It should be automatic on the switch. You can access it with Filament::getCurrentTenant() iirc
lazydog
lazydogOP7mo 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
jaocero7mo ago
use Filament::getTenant()
lazydog
lazydogOP7mo ago
Yes you are correct but needs to set/update Tenant first using setTenant.
jaocero
jaocero7mo 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