4 months ago

Soft delete on specific date

Posted 4 months ago by roerjo

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.

Please sign in or create an account to participate in this conversation.