diff --git a/src/AuditableTraitObserver.php b/src/AuditableTraitObserver.php index 86e9b34..b9b32aa 100644 --- a/src/AuditableTraitObserver.php +++ b/src/AuditableTraitObserver.php @@ -3,7 +3,6 @@ namespace Yajra\Auditable; use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Facades\Schema; class AuditableTraitObserver { @@ -59,7 +58,7 @@ public function saved(Model $model) { $updatedBy = $model->getUpdatedByColumn(); - if ($model->$updatedBy <> $this->getAuthenticatedUserId()) { + if ($this->getAuthenticatedUserId() && $model->$updatedBy <> $this->getAuthenticatedUserId()) { $model->$updatedBy = $this->getAuthenticatedUserId(); $model->save(); }