/** * Get related entity attribute * * @return Attribute * @throws UnknownAttributeException */ public function getEntityAttribute() { if (!$this->attributes->containsKey($this->entityAttributeName)) { throw new UnknownAttributeException('There is no entity attribute'); } return $this->attributes->get($this->entityAttributeName); }