Skip to content

Commit

Permalink
Merge pull request #3 from hexadog/develop
Browse files Browse the repository at this point in the history
fix(trait): issue when setting deleted_by attribute
  • Loading branch information
gaetan-hexadog authored Jul 5, 2021
2 parents 0c6b141 + f6c45e3 commit 450b6b4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Models/Traits/DeletedBy.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public function setDeletedByAttribute($user)
$userClass = config('auditable.models.user');
$userId = $user instanceof $userClass ? $user->getKey() : $user;

$this->unsetEventDispatcher();

if (!is_null($userId)) {
tap($this)->unsetEventDispatcher()
->forceFill(
['deleted_by' => $userId]
)->save();
$this->attributes['deleted_by'] = $userId;
$this->save();
}

$this->setEventDispatcher($events);
Expand Down

0 comments on commit 450b6b4

Please sign in to comment.