-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: RecordCustomAudit listener #963
Conversation
I'm assuming that fixing these tests also makes sense as well as correcting the listener |
@willpower232 There is a strange behavior, maybe there is a bug in the Laravel core. This does not work:
But this works:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes make sense to me, I would presume that the current way used to work at some point but only as an accident of how ambiguous ::dispatch
can be.
@erikn69 I think you refactored src/Auditable.php
back in #866 so presumably it worked for you then but as noted in the linked issue, isn't how laravel intended things to be dispatched so are you happy with these changes?
@willpower232 in #866 just unify the repeated code and small changes,
The Laravel code specifies that the same event object is sent to the I'm not happy changing the signature, but it is the most feasible solution that I see |
This is a breaking change, isn't it? Many of our tests are now failing with error: TypeError: OwenIt\Auditing\Listeners\RecordCustomAudit::handle(): Argument #1 ($event) must be of type OwenIt\Auditing\Events\AuditCustom, App\Models\Book given, called in ./vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php on line 479 Changing: If this is on purpose, a new major version should be released. |
This pull request fixes this problem: