EditAction hooks
does EditAction have hooks like these: afterCreate, afterSave, beforeValidate?
Filament\Tables\Actions\EditAction
Solution:
Jump to solution
Sorry for my carelessness, it turns out there are all the necessary hooks there.
I found them in the HasLifecycleHooks trait.
But they are not in the documentation of version 3, only in version 2....

7 Replies
Sorry for not specifying, I mean when there are no creation and editing pages. When everything happens in modal.
In my case, I need the beforeValidate hook, because this is the only hook that fires before the relationships are saved/created. (at least that’s how it works within a page)
Even without the page beforeValidate should still be called as it should be on the parent action if memory serves correctly.
Are you wanting to intercept / write to it? You could try adding it to the resource, I think the pages extend the resource which contain the hooks
the pages extend resource pages not resource.
these pages are contain the hooks:
Filament\Resources\Pages\CreateRecord
Filament\Resources\Pages\EditRecord
I researched actions but didn't find any hooks. I'm wondering if it's just me or other developers who need these hook? I can implement it and send PR 🤔
Ahh ok that makes sense, please feel free to do a PR if you are sure. I haven't had chance to review the sub classes. But I see no reason why Dan wouldn't want them on actions too.
Solution
Sorry for my carelessness, it turns out there are all the necessary hooks there.
I found them in the HasLifecycleHooks trait.
But they are not in the documentation of version 3, only in version 2.

No problem at alll. Always recommend using an IDE to test a theory too. Like phpStorm will show you all available methods on that class that are inherited or traited etc.