From d13b4a0c2d424774cb8a66f65092e199fc7e816f Mon Sep 17 00:00:00 2001 From: Matt Lantz Date: Fri, 24 May 2019 04:28:03 -0400 Subject: [PATCH] Update Locking.php (#16) * Update Locking.php fire method was removed in 5.8 * Other fire method call * Last fire method calls * Update FlushExpiredLocks.php --- src/FlushExpiredLocks.php | 2 +- src/Locking.php | 4 ++-- src/ModelLock.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) 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);