public function __get($name) { if ($this->hasAttribute($name)) { return $this->getAttribute($name); } else { return parent::__get($name); } }