Saving relationships on livewire Action
Hey guys,
I have a strange situation. I created a livewire component with Filament-Actions.
My action looks like this:
blade file:
Problem is, that the "teams" relationship will not be saved and is even not available at $form->getState()
What am I missing? 😮
4 Replies
Fields with relationships have the save logic built in and therefore do not pass on the state.
Hey @Dennis Koch, thank you for answering - unfortunately the relationships are not saved automatically on livewire components - at least on my end.
All other stuff is saved correctly - but not the relationship.
Just for completation:
My Page model has relation belongsToMany:
and the Team model has also a belongsToMany relation:
Ah, yeah - sorry for misunderstanding - I missed here in the example, that I want do pass the data through a manual saving process ->
And there I need the relationship in $data 🙂
but unfortunately I only get the array without the relationship-data:
You can try accessing the unvalidated data
$creator->data
. Not sure what's the correct way to get that relationship data.Solution
->dehydrated()
in the select will show it in the $data
array