slavcodev / laravel-event-recorder
Laravel Eloquent event recorder
Installs: 1 339
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ~7.3 || ~8.0
- laravel/framework: *
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-30 02:11:15 UTC
README
Event recorder trait useful when an event should be emitted only after model successfully saved.
Installation
Using Composer
composer require slavcodev/laravel-event-recorder
Usage
Just add the trait to any of you Eloquent model, it adds recordEvent($event)
method
and registers listener to emit all recorded events after save.
class User extends \Illuminate\Database\Eloquent\Model { use \Slavcodev\Laravel\Events\EventRecorder; public function someModifications() { $this->recordEvent(new UserChanged()); } }
Testing
phpunit
Contributing
Please see CONTRIBUTING and CODE OF CONDUCT for more details.