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
I have the following:
But I can't figure out where Filament actually processes this for saving -
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
It's the
saveRelationshipUsing() code. That's defined from the ->relationship() method. Select file line 953 to 980