Skip to content

Changed model attributes in created/updated/saved events get in $original without being saved in db #57689

@macropay-solutions

Description

@macropay-solutions

Laravel Version

12

PHP Version

8.2

Database Driver & Version

irrelevant

Description

Issue was discovered while improving the set calls during save (which has this related PR) see more here #31778 (comment)

Steps To Reproduce

Update a model and in its updated event set the updated_at column to 1 year in the future for example.

The db value will remain the same.
The $original and $attributes will hold the 1 year in the future date.
isDirty('updated_at') will be false because it will call originalIsEquivalent which will compare $original and $attributes and it will return true.

We solved it (for us) like in this comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions