diff --git a/src/Database/Relations/AttachOne.php b/src/Database/Relations/AttachOne.php index 52d7c386b..fac19c4e2 100644 --- a/src/Database/Relations/AttachOne.php +++ b/src/Database/Relations/AttachOne.php @@ -40,7 +40,7 @@ public function __construct(Builder $query, Model $parent, $type, $id, $isPublic public function setSimpleValue($value) { if (is_array($value)) { - $value = reset($value); + $value = current($value); } // Nulling the relationship diff --git a/src/Database/Relations/HasOne.php b/src/Database/Relations/HasOne.php index 65c333760..4dc22e886 100644 --- a/src/Database/Relations/HasOne.php +++ b/src/Database/Relations/HasOne.php @@ -34,7 +34,7 @@ public function __construct(Builder $query, Model $parent, $foreignKey, $localKe public function setSimpleValue($value) { if (is_array($value)) { - return; + $value = current($value); } // Nulling the relationship diff --git a/src/Database/Relations/MorphOne.php b/src/Database/Relations/MorphOne.php index 0e6bbd25a..cb312acfc 100644 --- a/src/Database/Relations/MorphOne.php +++ b/src/Database/Relations/MorphOne.php @@ -34,7 +34,7 @@ public function __construct(Builder $query, Model $parent, $type, $id, $localKey public function setSimpleValue($value) { if (is_array($value)) { - return; + $value = current($value); } // Nulling the relationship