Problem getting multiple select value in action modal form
How can I get multiple select values of form method in action method in Action class?
I didn't find it when I check in $data at action method function.
9 Replies
can someone help me?
So you won't get the options because you set it as a relationship so it'd not valid to this record, it will be saved automatically as part of the relationship?
If you are wanting to adjust the saving of the relationship see:
https://filamentphp.com/docs/3.x/forms/fields/repeater#mutating-related-item-data-before-creating
Sorry I don't get it..
How can I use it in relationship select in modal form, without repeater?
Filament saves the relationships separate and there is no need for the relationship to be in the data because it’s not part of it.
Explain in detail what you are trying to do.
->form([
Select::make('label_prospek')
->multiple()
->relationship(
'label_prospek',
'label',
fn(Builder $query) => $query
->whereHas('label_prospek', function (Builder $q) {
return $q->where('cms_users_id', auth()->user()->id);
})
)
])
In above class, I want to mutate the relationship data before saving, I need to fill other attributes in the relationship model.
Same principle should apply to a select
Where should I use method mutateRelationshipDataBeforeCreateUsing()?
It returns exception when I tried using it in table action class or in select class..
nevermind, i found the method similar to that, using saveRelationshipsUsing in select class..
thanks for your guidance before @toeknee
cheers