Event recorder trait useful when an event should be emitted only after model successfully saved.
Using Composer
composer require slavcodev/laravel-event-recorderJust 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());
}
}phpunitPlease see CONTRIBUTING and CODE OF CONDUCT for more details.