I have a question: in a Filament Form I have a manyToMany relationship rendered with a Checkboxlist. Before the db saving, I have to perform some "actions" with the values inside the list.
Possible that there is no way to handle that values?
I looked in the methods mutateFormDataBeforeSave or handleRecordCreation but the $data variable contains all the form data except the relationship one.
If anyone still needs it, you can use the
saveRelationshipsUsing()method inChecboxListfield, and you can inject your required utilities accordingly. Injecting$statewill give you an array of the checked model Ids. Below is a snippet I use in my project.Here,
$modelgives the resource model, and state gives the selected categories ids like[1,3,4]