Maarten Paauw
ImportAction in combination with tenancy
Today I've upgraded my side project to Filament V3.1 to toy around with the new ImportAction. The application uses the build in multi tenacy (tenant model named Organization) and a custom auth guard named 'organizer' (with auth model Organizer). With the application organizers within an organization can manage Spots. The idea is to make these spots importable using the new ImportAction.
First error I encountered was I'd had to add
$this->app->bind(Authenticatable::class, Organizer::class);
to a service provider, otherwise the Import
model could not resolve the "user". Is this intended?
Secondly, The imported spots needs to be associated with the tenant (Organization). I've tried to receive to tenant using Filament::tenant()
within the resolveRecord
method, but this resolves to NULL. I think the reason is I'm using Horizon (Redis) as queue and Filament::tenant()
only works on request lifecycle. How can I associate the current tenant to an imported record?9 replies