andeancondor_74
mutateFormDataBeforeCreate not running on create from Relation Manager
I have a Filament resource and in its Create page I implemented the mutateFormDataBeforeCreate method to populate the user_id from the auth object. Ex:
$data['user_id'] = auth()->id();
It works well and gets populated on Resource create. However, I also have a RelationManager on a related Model for this same Resource and when I click the create action and complete the form the user_id is missing and the create fails because its a required field in the db.
Why is that? Am I missing something?
6 replies
Custom Action in the Resource Edit Page
I’m new to Filament but so impressed with what it can do. Working on an Application resource & need a custom action “Finalize Application” next to the Save changes button of the EditApplication page.
The experience is for the user to save draft changes with the normal EditAction button & use the custom action button when they are ready to finalize their application and be done making changes. In the Edit page I added the custom action under getFormActions() and for action() it calls a finalize method. I need to access the mutateFormDataBeforeSave() & getRedirectUrl() to change status and redirect to index when the custom action button is clicked. How do I do that and NOT trigger it when the normal Edit Action Save changes button is clicked?
The experience is for the user to save draft changes with the normal EditAction button & use the custom action button when they are ready to finalize their application and be done making changes. In the Edit page I added the custom action under getFormActions() and for action() it calls a finalize method. I need to access the mutateFormDataBeforeSave() & getRedirectUrl() to change status and redirect to index when the custom action button is clicked. How do I do that and NOT trigger it when the normal Edit Action Save changes button is clicked?
4 replies