From bac26fbb54d98e4be8d460559729b8d7ea13ce74 Mon Sep 17 00:00:00 2001 From: Vahid Amiri Motlagh Date: Mon, 13 Jun 2022 20:19:39 +0200 Subject: [PATCH] Loose comparison causes the value not to be saved when the field is object --- src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index c9d12ae8f474..95d07e75aaab 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -1956,8 +1956,8 @@ public function originalIsEquivalent($key) return $this->fromDateTime($attribute) === $this->fromDateTime($original); } elseif ($this->hasCast($key, ['object', 'collection'])) { - return $this->castAttribute($key, $attribute) == - $this->castAttribute($key, $original); + return $this->fromJson($attribute) === + $this->fromJson($original); } elseif ($this->hasCast($key, ['real', 'float', 'double'])) { if (($attribute === null && $original !== null) || ($attribute !== null && $original === null)) { return false;