This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

vimre
vimre

Hi All,

It seems soft deletion of a model does not fire beforeDelete event.
Which event should I listen to in case of soft deletion to run some action after a model has been soft deleted?

Thanks in advance for your help

vimre
vimre

Update + Solution:

It seems soft delete fires beforeDelete observer, but you cannot update attribute under beforeDelete event as you would do in any other case, because during this event you have access to deleted_at attribute only.
Detals: https://github.com/laravel/framework/pull/36064

If you would like to change any other attribute during deletion, then you have to make an update as well before delete. Unfortunately it means two query for one delete... but at least it works.

daftspunky
daftspunky

Interesting, thanks for reporting back!

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.