BelongsToMany Select component doesn't populate data in a modal form
I have an action on a table that opens a modal form to manage a
BelongsToMany
(many-to-many) relationship. This is my action code on my table:
According to the documentation: https://filamentphp.com/docs/3.x/forms/fields/select#integrating-with-an-eloquent-relationship
Filament will load the options from the relationship, and save them back to the relationship's pivot table when the form is submitted.Filament is saving no problem, but it's not loading the values already associated with the model. I tried using the
->fillForm()
method but then the ->options()
array is blank. I don't understand what I'm doing wrong here?
In the screenshot, some of these options are already associated with this account but the form doesn't indicate this.2 Replies
Solution
?
options()
isn't necessary I guessI swear I tried this already... it's working though.
Must have had a slight variation. Thanks!