Skip to content

Commit

Permalink
fix casting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 4, 2020
1 parent 7ab5b4b commit 2b395cd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -1364,9 +1364,12 @@ public function originalIsEquivalent($key)
} elseif ($this->isDateAttribute($key)) {
return $this->fromDateTime($attribute) ===
$this->fromDateTime($original);
} elseif ($this->hasCast($key, static::$primitiveCastTypes)) {
} elseif ($this->hasCast($key, ['object', 'collection'])) {
return $this->castAttribute($key, $attribute) ==
$this->castAttribute($key, $original);
} elseif ($this->hasCast($key, static::$primitiveCastTypes)) {
return $this->castAttribute($key, $attribute) ===
$this->castAttribute($key, $original);
}

return is_numeric($attribute) && is_numeric($original)
Expand Down

0 comments on commit 2b395cd

Please sign in to comment.