Refactoring Eloquent.

This commit is contained in:
Taylor Otwell 2011-07-08 08:00:04 -07:00
parent c4eb994fbc
commit 7af9e08a60
1 changed files with 1 additions and 6 deletions

View File

@ -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;