exists && ! $key) { throw new \LogicException("No attribute ".var_export($key, true)); } return parent::getAttribute($key); } /** * Get a relationship. * * @param string $key * @return mixed */ public function getRelationValue($key) { if ($this->exists && !method_exists($this, $key)) { throw new \LogicException("No attribute or relation ".var_export($key, true)); } return parent::getRelationValue($key); } }