Event Before any Model

Hello,

I am wondering if there is any event before deleting a model or after deleting a model. We are using a softDelete but sometimes we also want to log this because of some internal reasons that who delete this entry and so on. and the best to do it to log the model activity that when it is deleted and by whom(current logged in user)

Hi @ibrarartisan,

Please check out the Revisionable Trait.

@apinard thanks. actually i was looking more for something

eloquent.deleting or eloquent.deleted events.

As i understand Revisionable Trait will only work on non-soft-deleted or non-deleted entries e.g saving an existing model with dirty fields.

As i understand Revisionable Trait will only work on non-soft-deleted or non-deleted entries e.g saving an existing model with dirty fields.

The Revisionable Trait also works with soft-deleted models.

For information on performing actions during a model event, refer to the documentation here: Models - October CMS - 3.x.

1 Like

@apinard thanks alot. Yes exactly that’s what i was looking for.

1 Like