Skip to content

Commit

Permalink
fix new events handling
Browse files Browse the repository at this point in the history
  • Loading branch information
n7olkachev authored Oct 5, 2017
1 parent 422ed5e commit ce4d839
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/EventSourceableServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ public function register()

private function registerEvents()
{
$this->app['events']->listen('eloquent.saved*', function ($event, $model) {
$this->app['events']->listen('eloquent.saved*', function ($event, $payload) {
$model = $payload[0];
if ($model instanceof EventSourceableInterface) {
$model->saveDiff();
}
});

$this->app['events']->listen('eloquent.deleted*', function ($event, $model) {
$this->app['events']->listen('eloquent.deleted*', function ($event, $payload) {
$model = $payload[0];
if ($model instanceof EventSourceableInterface) {
$model->saveDiff();
}
Expand Down

0 comments on commit ce4d839

Please sign in to comment.