headerActions: "mutateFormDataUsing" method not working in RelationManager table
Context:
I'm in a RelationManager, I want to add a CreateAction::make() button in "headerActions" at the "table" method.
I also use "spatie-laravel-translatable-plugin"
The following code below (cf. screenshot) does not work. The "mutateFormDataUsing" method for modifying the data on save is not taken into account. Any idea or is this a bug?
Thank you for your help.
Solution:Jump to solution
Probably there's a Page Action which has the same name. Action names must be unique.
7 Replies
I am using same function and i had the same issue, altered data was not taken in account. So i just alter data directly inside the function and save it before returning it back.
Ho ok, but in my case it's really strange because for example this code is not even executed. The only difference for the moment with your code is that I am using CreateAction and not EditAction.
I just tried on an Edit Action button, it actually works, the method is called correctly. This is therefore a problem on the CreateAction.
In any case, thank you @dariusiii for your very informative feedback.
I'm having the same problem and yes it does work in EditAction but not in CreateAction. Have you made any workaround?
Not sure why, but if I'm only using
CreateAction::make()
the ->mutateFormDataUsing()
is not being called but if I pass a string name to CreateAction::make('New Resource')
it works.Do you have a duplicate action? π€
Solution
Probably there's a Page Action which has the same name. Action names must be unique.
I see, I do have a CreateAction inside emptyStateActions and headerActions so it's kinda duplicated. I tried removing the other action inside emptyStatections so now it's working, the mutateFormDataUsing() is now being triggered. Thanks for the answer π