Form Select `createOptionForm` in v3 Multi Tenant

I followed the v3 documentation for Multi Tenant setup, and have a Resource form with a Select where I'm trying to "create a new option in a modal" (https://filamentphp.com/docs/3.x/forms/fields/select#creating-a-new-option-in-a-modal). The foreign key for the tenant id isn't getting populated when the modal Create action occurs and I'm wondering if there's something else I need to specify with the createOptionForm code. (I am able to successfully create the other resource via it's own Modal (using a "Simple modal resource")). I am using Filament v3.0.18.
2 Replies
Clay Bitner
Clay Bitner16mo ago
I had the same problem, so I had to add: Forms\Components\Hidden::make('tenant_id')->default($tenant->id), to the $form schema and set $tenant = Filament::getTenant(); before the $form gets created.
jeremyb6
jeremyb6OP16mo ago
Thanks for this tip @claybitner , I will give it a try!
Want results from more Discord servers?
Add your server