Add ability to suppress observer events #654
Labels
easy
These issues are geared for people who have not yet contributed to this project yet
enhancement
A feature that exists, works as intended but needs to be improved
Describe the feature as you'd like to see it
Similar to Laravel's
withoutEvents()
andsaveQuietly()
, it would be nice to be able to deterministically suppress model events either with a context manager, method, flag, or some combination of the three.It would also be nice to choose which events to suppress in the event that an action fires multiple (for instance, I believe
save()
firessaving
,updating
,saved
, andupdated
). See: https://laravel.com/docs/9.x/eloquent#muting-events for inspiration.What do we currently have to do now?
Currently, there is no way to suppress model events from firing. This is useful in a variety of scenarios. For instance, if you want to add data to a model after successful creation, there is currently no way to do so without triggering multiple events. If your observer emits global events for consumption across your app, this could cause issues.
The text was updated successfully, but these errors were encountered: