FilamentF
Filament3y ago
Wint

How can I know which was changes on a Select field using relationship()?

My edit form inside the resource is simple, using the relationship() function for a BelongsToMany relationship
Forms\Components\MultiSelect::make('handle_departments') ->relationship('handle_departments', 'name')
I'm trying to create a history record after user made changes on the relationship, but couldn't get the information about the changes.
I looked into the EditRecord's lifecycle and seems it's can only be retrieved in beforeValidate hook
So, how can I know the old values and new values of this relationship in this hook? I'm thinking about creating a hidden field to get the values, do you have any other suggestion?
Was this page helpful?