F
Filament14h ago
Maxime

How can i trigger model events when changing pivot table

I have a filament select going like that :
Forms\Components\Repeater::make('songArtists')
->relationship()
->schema([
Forms\Components\Select::make('artist_id')
->relationship('artist', 'name')
->createOptionForm(fn(Form $form) => ArtistResource::form($form))
->required(),
]),
Forms\Components\Repeater::make('songArtists')
->relationship()
->schema([
Forms\Components\Select::make('artist_id')
->relationship('artist', 'name')
->createOptionForm(fn(Form $form) => ArtistResource::form($form))
->required(),
]),
I added an updated() booted event to my Song model but it does not trigger when i update the selected artists. (as i expected) Is there an easy way to get, uppon saving the edit form, a clean "before" => "after" array with the artists ? Calling the events directly in my ArtistSong model does not seem to help
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?