diff --git a/src/FlushExpiredLocks.php b/src/FlushExpiredLocks.php index 6ef7301..013d312 100644 --- a/src/FlushExpiredLocks.php +++ b/src/FlushExpiredLocks.php @@ -29,7 +29,7 @@ public function handle(Dispatcher $events) ModelLock::expired()->delete(); foreach ($unlocked as $model) { - $events->fire(new ModelUnlocked($model)); + $events->dispatch(new ModelUnlocked($model)); } $this->info('Expired model locks flushed!'); diff --git a/src/Locking.php b/src/Locking.php index f9d06ab..1108430 100644 --- a/src/Locking.php +++ b/src/Locking.php @@ -104,7 +104,7 @@ public function lock($duration = null, $user = null) $this->setRelation('modelLock', $lock); if ($events = $this->getEventDispatcher()) { - $events->fire(new ModelLocked($this)); + $events->dispatch(new ModelLocked($this)); } return $lock->getToken(); @@ -122,7 +122,7 @@ public function unlock() unset($this->relations['modelLock']); if ($events = $this->getEventDispatcher()) { - $events->fire(new ModelUnlocked($this)); + $events->dispatch(new ModelUnlocked($this)); } return $this; diff --git a/src/ModelLock.php b/src/ModelLock.php index 455abe9..8e45ea3 100644 --- a/src/ModelLock.php +++ b/src/ModelLock.php @@ -43,7 +43,7 @@ protected static function boot() static::deleted(function ($lock) { if ($lock->model && $events = $lock->getEventDispatcher()) { - $events->fire(new ModelUnlocked($lock->model)); + $events->dispatch(new ModelUnlocked($lock->model)); } }); } @@ -156,7 +156,7 @@ protected function lockingUser($user = null) public function requestUnlock($user = null, $message = '', $shorten = true) { if ($events = $this->getEventDispatcher()) { - $events->fire(new ModelUnlockRequested($this->model, $user, $message)); + $events->dispatch(new ModelUnlockRequested($this->model, $user, $message)); if ($shorten && $new_duration = config('model_locking.request_shorten_duration')) { $this->lock($new_duration, $this->user_id);