multi-select with relationship not returning data
Good afternoon.
I'm currently trying to make a Filament action on a livewire page which sends a message to selected users.
To select the users I'm using a multi-select. And I added a createOptionForm so a user can add additional users they want to message. This all works wonderful, except when I submit the form the data doesn't to exist (see picture).
I don't know if this is a bug in Filament or if I'm doing something wrong.
Said select
How I catch the data from the form
17 Replies
First thing, remove the the owner_id and owner_type from the form and put it into the mutate
Second, closure the options
->options(fn() => Auth::user()->contacts()->pluck('email', 'id'))
What does the create option form look like on rendering?
It just appears as a modal. And when I submit it, it just creates the new model and adds it to the selected options within the multi-select. So it just works as it's supposed to.
And the main modal / form looks like this. (If that is relevant)
Hang on, where did the DD come from? Tjhe main model form or the creationOptionForm?
main model form
This is the entire Action if that is useful
try:
That did not work sadly
Are you fully up to date? If you deselect it then reselect it does it work?
Are you fully up to date?I did a composer update right before I send the initial message. Currently on version 3.0.50.
If you deselect it then reselect it does it work?No, whatever option I choose (even if it's just created) nothing shows up in the dd
strange, I'm not too sure
Yap, I've been through this with my senior and and he couldn't figure it out either. The strange thing is that when i remove
Or when I remove
The data appears again
But the relationship is needed for the createOptionForm. And the multiselect is just very user friendly.
And the relationship is a belongsToMany?
No, a message has one receiver. I just send the same message multiple times to the chosen contacts. This is because how each message is shown somewhere else in the website
That should be find
find?
fine*
this is within the Message model btw. Forgot to mention that, my bad