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

ifabrik's avatar

What is the difference between saving and saved Event

There are several event types described on https://laravel.com/docs/5.4/eloquent#events

What is the difference between the different types for actions, for example the "saving" and "saved" event?

0 likes
5 replies
martinbean's avatar
Level 80

@ifabrik “Saving” occurs before being persisted to the database. “Saved” is fired after the record has been saved to the database.

ifabrik's avatar

Ok, thanks for your answer.

By the way, is there a possibilty to get the unchanged Model before saving. The target is to get the changed attributes to create a history which attributes has changed.

tykus's avatar

Have a look at this series which has a couple of episode for tracking document adjustments.

1 like
ifabrik's avatar

@tykus thanks for the hint to this series, i thought this will do it :)

1 like

Please or to participate in this conversation.