Laravel ObservedBy Attribute
Learn how to use Laravel 11+ ObservedBy attribute for cleaner model observers. Includes practical use cases like audit logging, notifications, cache invalidation, and more.
February 3, 2026•1 min read•ssbhattarai
What is ObservedBy?
The #[ObservedBy] attribute (Laravel 11+) lets you attach observers directly to your model instead of registering them.
Before vs After
Old Way (Laravel 10 and below):
// Model
class User extends Model {
//
}
// AppServiceProvider.php
public function boot(): void
{
User::observe(UserObserver::class);
}
New Way (Laravel 11+):
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
#[ObservedBy([UserObserver::class])]
class User extends Model {
//
}
Benefits
Self-documenting - See observers directly on the model
No service provider clutter - Everything in one place
Multiple observers - Easy to add/remove
Type-safe - IDE autocomplete support
For comprehensive use cases and alternative implementation methods, refer to the official documentation.