laravel-event-recorder maintained by slavcodev
Description
Laravel Eloquent event recorder
Author
Last update
2024/03/30 01:32
(dev-main)
License
Downloads
1 999
Laravel Eloquent event recorder
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.