Multi Tenancy associate Tenant to Resource
I have created a model that has a
team_id
column and also a team()
relation to the Team
model. The Team
model has been setup as the tenant
model on the Provider.
Do I need to do anything else in each resource to associate the tenant id for the CRUD operations?
I get this error when I create a new record on a resource inside the Multi Tenancy Panel
Any advice?4 Replies
OK, I actually figured out the issue. Not sure if this is a bug. When I use the CreateAction that is setup on the ListResource class, the record gets created correctly. But, if I use the same
CreateAction
on the emptyStateActions
for the Table class, then the tenancy doesn't get associated. Do I need to do anything extra?
Here is the code to my emptyStateActions
method
I am assuming there is tenancy association happening on the
ListResource
class here https://github.com/filamentphp/filament/blob/3.x/packages/panels/src/Resources/Pages/ListRecords.php#L109. Does this also need to be done when using the createAction
on emptyState
sections?GitHub
filament/packages/panels/src/Resources/Pages/ListRecords.php at 3.x...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
the
relationship
method is being used https://github.com/filamentphp/filament/blob/3.x/packages/panels/src/Resources/Pages/ListRecords.php#L120 to assign the tenant, but I can't seem to find that on the Tables\Actions\CreateAction
class
@Dan Harrin @Leandro Ferreira any advice is much appreciated..abishek has been warned, this is their first warning.