From d7305952e07d541622b31de41fbab16704de095c Mon Sep 17 00:00:00 2001 From: Leandro Guindani Gehlen Date: Thu, 25 Aug 2022 17:21:24 -0300 Subject: [PATCH] Remove unnecessary check --- src/Database/Concerns/ResourceSyncing.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Database/Concerns/ResourceSyncing.php b/src/Database/Concerns/ResourceSyncing.php index 4708faba..3d6c4cc2 100644 --- a/src/Database/Concerns/ResourceSyncing.php +++ b/src/Database/Concerns/ResourceSyncing.php @@ -20,10 +20,10 @@ trait ResourceSyncing }); static::creating(function (self $model) { - $key = $model->getGlobalIdentifierKeyName(); + $keyName = $model->getGlobalIdentifierKeyName(); - if (! $model->getAttribute($key) && app()->bound(UniqueIdentifierGenerator::class) && $model->isSyncEnabled()) { - $model->setAttribute($key, app(UniqueIdentifierGenerator::class)->generate($model)); + if (! $model->getAttribute($keyName) && app()->bound(UniqueIdentifierGenerator::class)) { + $model->setAttribute($keyName, app(UniqueIdentifierGenerator::class)->generate($model)); } }); }