You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed a difference in the sequence of model events triggered by the restore and delete methods.
The model uses the SoftDeletes trait.
When calling the restore method, the following events are fired:
restoring → saving → updating → updated → saved → restored
(Data is saved to the database using $this->save())
When calling the delete method, the event sequence is:
deleting → trashed → deleted
(Data is saved to the database using $query->update($columns) directly, bypassing save().)
This inconsistency in behavior may affect observers or logic that depends on the saving/saved events, as they're triggered during restore but not during delete.
Is this difference intentional? If not, it might be worth considering aligning the behavior to make both flows consistent.
This discussion was converted from issue #55966 on June 10, 2025 02:31.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
12.15.0
PHP Version
8.3.1
Database Driver & Version
No response
Description
I've noticed a difference in the sequence of model events triggered by the restore and delete methods.
When calling the restore method, the following events are fired:
restoring → saving → updating → updated → saved → restored
(Data is saved to the database using $this->save())
When calling the delete method, the event sequence is:
deleting → trashed → deleted
(Data is saved to the database using $query->update($columns) directly, bypassing save().)
This inconsistency in behavior may affect observers or logic that depends on the saving/saved events, as they're triggered during restore but not during delete.
Is this difference intentional? If not, it might be worth considering aligning the behavior to make both flows consistent.
Steps To Reproduce
Beta Was this translation helpful? Give feedback.
All reactions