F
Filament5mo ago
JG

Filament::getTenant() is null on AJAX calls

When things are updated like table poll requests, it uses a middleware I am using to sync the spatie permission team id with the filament team. This works well on page requests but on AJAX requests Filament::getTenant() is null. Any idea how I can fix that?
Solution:
fixed it by adding IdentifyTenant::class, SyncSpatiePermissionsWithFilament::class, to the end of the ->middleware() method of the panel...
Jump to solution
2 Replies
JG
JGOP5mo ago
I can tell that it has something to do with the order in which the middlewares are executed. Looks like IdentifyTenant is executed after other tenant middlewares and this is why it fails. For web request routes it does this so it makes sure the tenant is set before: public function getTenantMiddleware(): array { return [ IdentifyTenant::class, ...$this->tenantMiddleware, ]; }
Solution
JG
JG5mo ago
fixed it by adding IdentifyTenant::class, SyncSpatiePermissionsWithFilament::class, to the end of the ->middleware() method of the panel
Want results from more Discord servers?
Add your server