mutateFormDataUsing not called if no form is present
I am trying to use a CreateAction on a RelationManager to create a new item. There is no form data the user needs to enter. The item should be created automatically using the parent model's ID and
auth()->id()
. I am trying to use mutateFormDataUsing to inject the user_id into the form data before saving, but it does not seem to be called when there isn't a form modal...Solution:Jump to solution
Aha, I figured it out. I can use
CreateAction::make()->using()
and $this->ownerRecord
to access the parent record to get the ID needed to create the model.2 Replies
That makes sense. You could instead just modify the CreateAction to create a new item/model
Solution
Aha, I figured it out. I can use
CreateAction::make()->using()
and $this->ownerRecord
to access the parent record to get the ID needed to create the model.