Skip to content

Commit

Permalink
[5.3] return null if an empty key was passed to getAttribute (#15874)
Browse files Browse the repository at this point in the history
*            return null if an empty key was passed to getAttribute

*     fix code style
  • Loading branch information
themsaid authored and taylorotwell committed Oct 12, 2016
1 parent 394ec05 commit cd3e3cd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -2596,6 +2596,10 @@ protected function getArrayableItems(array $values)
*/
public function getAttribute($key)
{
if (! $key) {
return;
}

if (array_key_exists($key, $this->attributes) || $this->hasGetMutator($key)) {
return $this->getAttributeValue($key);
}
Expand Down

0 comments on commit cd3e3cd

Please sign in to comment.