How do form fields with relationships work?
I'm using the spatie roles and permissions on my Filament panel, and would like to write some tests to assert that permissions change appropriately in my
EditRole
form. The result I'm seeing is that in my tests if I populate the permissions
form field with permission IDs, no changes are being saved specifically in the test. So I thought I'd dive in to see how the relation fields work.
I have the following:
But I can't figure out where Filament actually processes this for saving - handleRecordUpdate
and mutateFormDataBeforeSave
don't have any permissions
key, but the permissions update just fine.Solution:Jump to solution
It's the
saveRelationshipUsing()
code. That's defined from the ->relationship()
method. Select
file line 953 to 9802 Replies
Solution
It's the
saveRelationshipUsing()
code. That's defined from the ->relationship()
method. Select
file line 953 to 980Thanks, I'll dive into that π