Skip to content

Commit 3752aa8

Browse files
committed
check the raw attributes and casts array as it is much faster
1 parent 06ba2a9 commit 3752aa8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ public function getAttribute($key)
353353
// If the attribute exists in the attribute array or has a "get" mutator we will
354354
// get the attribute's value. Otherwise, we will proceed as if the developers
355355
// are asking for a relationship's value. This covers both types of values.
356-
if (array_key_exists($key, $this->getAttributes()) ||
356+
if (array_key_exists($key, $this->attributes) ||
357+
array_key_exists($key, $this->casts) ||
357358
$this->hasGetMutator($key) ||
358359
$this->isClassCastable($key)) {
359360
return $this->getAttributeValue($key);

0 commit comments

Comments
 (0)