gpanos / laravel-observe-attribute
Register model observers using php 8 attributes
1.0.0
2021-08-24 14:41 UTC
Requires
- php: ^8.0
- illuminate/database: ^8.0
- illuminate/support: ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- mockery/mockery: ^1.3
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-11-09 13:49:40 UTC
README
Instead of defining observers inside service providers this package offers an alternative way to register model observers for your Laravel applications.
Inspired by spatie/laravel-route-attributes
Installation
composer require gpanos/laravel-observe-attribute
Usage
To register an observer add the Observe
attribute to your model and pass it your observer class.
<?php #[Observe(UserObserver::class)] class User extends Authenticatable { ... }