0

A bit confused about model events behaving when using SoftDelete trait. Which event will be fired when object will be deleted? forceDeleted?

huuuk
  • 4,597
  • 2
  • 20
  • 27
  • Possible duplicate of [Laravel force delete event on relations](http://stackoverflow.com/questions/34952259/laravel-force-delete-event-on-relations) – patricus May 23 '16 at 06:43

2 Answers2

1

A quick glance into laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletes.php shows that SoftDeletes adds two new model events: 'restoring' and 'restored'.

Therefore, you have to listen for the standard events: 'deleting' and 'deleted'. There is no a special 'soft-deleting' kind of event. Also, there are no force deletion events, either.

Denis Mysenko
  • 6,366
  • 1
  • 24
  • 33
0

I've figured out how to implement this feature. There are forceDeleting property in SoftDeletes trait. Which indicates are model deleting soft or hard at the moment. So I need only check this property in my event handler.

huuuk
  • 4,597
  • 2
  • 20
  • 27