Skip to content

Commit

Permalink
Cast attribute manually
Browse files Browse the repository at this point in the history
  • Loading branch information
gdebrauwer committed Sep 13, 2021
1 parent d76eaa3 commit 899e3c1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -1659,10 +1659,12 @@ public function originalIsEquivalent($key)
return $this->castAttribute($key, $attribute) ===
$this->castAttribute($key, $original);
} elseif ($this->isClassCastable($key)) {
$original = $this->normalizeCastClassResponse($key, $this->resolveCasterClass($key)->set(
$caster = $this->resolveCasterClass($key);

$original = $this->normalizeCastClassResponse($key, $caster->set(
$this,
$key,
$this->castAttribute($key, $original),
$caster instanceof CastsInboundAttributes ? $original : $caster->get($this, $key, $original, $this->attributes),
$this->attributes
));

Expand Down

0 comments on commit 899e3c1

Please sign in to comment.