Skip to content

Commit

Permalink
Update Locking.php (#16)
Browse files Browse the repository at this point in the history
* Update Locking.php

fire method was removed in 5.8

* Other fire method call

* Last fire method calls

* Update FlushExpiredLocks.php
  • Loading branch information
mlantz authored and jarektkaczyk committed May 24, 2019
1 parent fc8e940 commit d13b4a0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/FlushExpiredLocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
Expand Down
4 changes: 2 additions & 2 deletions src/Locking.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/ModelLock.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
});
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d13b4a0

Please sign in to comment.