Replies: 1 comment
-
This has now been implemented https://laravel.com/docs/11.x/eloquent#saving-a-single-model-without-events |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I ran into an issue with a Model Observer listening for the 'deleting' event when deleting relationships of a model recursively (all tables with softdeletes: people - addresses - address_person, where people can assigned to many addresses and vice versa).
It seemed as if it never finished 'deleting' and therefore was playing 'pingpong' between addresses and people. As there are a few implementations of quiet methods, but not for deleting, I tried to add this code to Illuminate\Database\Eloquent\Model and it didn't loop infinitely anymore. Finally i moved that code into a separate trait, which is fine for me as well.
I assume, it can applied at least to L8 or even before... maybe also for the other events?
Accordingly this applies to restore() in the SoftDeletes Trait as well:
I'm not too familiar with other dependencies and this solution has probably to be tested more.
Beta Was this translation helpful? Give feedback.
All reactions