Skip to content

Commit 3ae6f31

Browse files
committed
Add a note on the ObservedBy attribute
1 parent b6377a4 commit 3ae6f31

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ provider which results in every model in your application with a observer is "bo
1212
package aims to reduce that overhead by connecting listeners just-in-time whenever the Eloquent model is booted (first used) in the request. The event callbacks are also
1313
defined on the model itself keeping the code cleaner, althought this is my preference of course and if you disagree this might not be the package for you.
1414

15+
> [!NOTE]
16+
> Laravel 10.44 [introduced](https://laravel-news.com/laravel-10-44-0#content-new-observedby-attribute-for-models) the `ObservedBy` attribute which allows you to define the observer on the model itself which negates all the performance benefits of this package.
17+
> However this package still provides an alternative way to define the event handler methods on the model itself so might still be considered useful but using the `ObservedBy` attribute will solve the performance issue with registering the model observers inside a service provider.
18+
1519
## Installation
1620

1721
```bash

0 commit comments

Comments
 (0)