Skip to content

@event directive not returning "changes" on model #2151

@eNzyOfficial

Description

@eNzyOfficial

Describe the bug

For some reason using @event directive with @create (and possibly @update) removes all the changes made in the model.

For example if you $model = User::create(...) you can $model->getRawOriginal() and $model->getAttributes() (and other similar functions) to get the original and changed attributes.

This is missing and these 2 functions return the same data and $model->getChanges() is an empty array.

Steps to reproduce

Dispatch an event on @create

createCompany(input: CompanyCreateInput! @spread): Company!
        @create
        @event(dispatch: "App\\Events\\ModelCreated")

Inside the listener, check the model for changes:

$model->getChanges()

or compare $model->getRawOriginal() and $model->getAttributes()

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionRequest for support or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions