Skip to content

Commit d33c040

Browse files
committed
Mantain parent logic on attribute read for non dot keys
1 parent 3868446 commit d33c040

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Jenssegers/Mongodb/Eloquent/Model.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,12 @@ public function getAttribute($key)
237237
*/
238238
protected function getAttributeFromArray($key)
239239
{
240-
return array_get($this->attributes, $key);
240+
// Support keys in dot notation.
241+
if (str_contains($key, '.')) {
242+
return array_get($this->attributes, $key);
243+
}
244+
245+
return parent::getAttributeFromArray($key);
241246
}
242247

243248
/**

0 commit comments

Comments
 (0)