Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

roerjo's avatar
Level 19

Soft delete on specific date

Anybody know of a way to have a model soft deleted on a passed in date rather than the current date/time? I want to call a soft delete which will trigger the deleted model event (which I have setup to cascade that soft delete to certain related models).

I suppose I could just use the QueryBuilder and call DB::table('blah')->where('id', $id)->update(['deleted_at' => {date_string}]);, but then I'll need to cascade that soft delete manually as well (and I also want that specific date to cascade).

It would be nice if I could just call $model->delete({date_string}); but it doesn't look like the delete() method accepts any params according to API docs.

0 likes
1 reply
Snapey's avatar

you would probably have have a regular job that runs and deletes anything with an expiry date in the past

Please or to participate in this conversation.