tg
Determine if form is in modal inside a configureUsing closure?
Is there a way to determine inside the
Forms\Component\Tabs::configureUsing
closure if the Tabs component is rendered inside an action modal container?
Context
I've enabled Forms\Components\Tabs::persistTabInQueryString()
(docs) globally through a Tabs::configureUsing
closure. This works as expected on resource pages. However, some of my forms with tabs also appear inside action modals. The tab persistence works there as well, but does not make sense as the modal state itself is not persisted across browser tabs – which is expected behavior. While it does not break my app right now, I guess it will introduce conflicts sooner or later when a tab on the page has the same name as a tab inside the modal. Definitely the case once I open a resource form inside a modal on top of a resource page that has the same resource type.2 replies
Move resource form buttons to header
How can I move the submit/cancel and custom buttons of a resource form to another section of the page, e.g. together with the page header actions or above the form?
If that is not possible, how can I call the form actions from a custom header actions, provided the actual action is hidden?
2 replies
Must <foreign_model>_id be fillable to save it on resource creation?
I have two models, Opportunity -> belongsTo -> Company. The
opportunities
table has a company_id
field which is * not nullable* to ensure data integrity. The Opportunity
model has a relationship company
.
Note that company_id
is not included in $fillable
, as other sections of my app outside the Filament admin panel should not be able to alter this relationship through requests.
My OpportunityResource::form
field for the relationship:
On the EditOpportunity
page, I can alter the associated company just fine. On CreateOpportunity
however, I can select a company but I get this error:
If I add company_id
to Opportunity::$fillable
, it works as expected.
I'd expect consistent behavior between Create and Edit, so either require company_id
in $fillable
on both operations or on neither.2 replies