where to put afterDelete()

I have a resurce that also have a fileupload. when deleting the resource, I would like to delete the file as well. I can see that there is a afterDelete hook, but I cannot figure out where to implement my logic I have tried in the List and EditRecord page, but it does not get called. Is there a better way to do this ?
4 Replies
Patrick Boivin
Strange, I believe it should work on the Edit page... Have you tried a model observer? https://laravel.com/docs/10.x/eloquent#observers
Dan Harrin
Dan Harrin2y ago
i would do this in a model observer too
rabol
rabolOP2y ago
Ok, Observer it is, but... when is afterDelete called and used for then ?
Dan Harrin
Dan Harrin2y ago
try DeleteAction::make()->after(fn () => dd('test'))
Want results from more Discord servers?
Add your server