Refactoring Eloquent.
This commit is contained in:
parent
c4eb994fbc
commit
7af9e08a60
|
@ -369,12 +369,7 @@ public function __get($key)
|
|||
{
|
||||
$model = $this->$key();
|
||||
|
||||
if (in_array($this->relating, array('has_one', 'belongs_to')))
|
||||
{
|
||||
return $this->ignore[$key] = $model->first();
|
||||
}
|
||||
|
||||
return $this->ignore[$key] = $model->get();
|
||||
return $this->ignore[$key] = (in_array($this->relating, array('has_one', 'belongs_to'))) ? $model->first() : $model->get();
|
||||
}
|
||||
|
||||
return (array_key_exists($key, $this->attributes)) ? $this->attributes[$key] : null;
|
||||
|
|
Loading…
Reference in New Issue