Skip to content

possible fix for double event registration in child models when calling events from parent trait use#143

Open
solis-eduardo wants to merge 2 commits intotighten:mainfrom
solis-eduardo:main
Open

possible fix for double event registration in child models when calling events from parent trait use#143
solis-eduardo wants to merge 2 commits intotighten:mainfrom
solis-eduardo:main

Conversation

@solis-eduardo
Copy link
Copy Markdown

Came across this issue when using owen-it/laravel-auditing.
My Model class uses the Auditable trait, but the events are registered twice because parentIsBooting only accounts for traits used by the parent class itself, to solve this problem I created a static array for parent classes and added an alternative isset verification, similar to the preexisting $parentBootMethods logic.

@solis-eduardo
Copy link
Copy Markdown
Author

Forgot to mention: it can be bypassed by declaring a empty boot method, like so:

    public static function boot() {
        parent::boot();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant