/** * @inheritdoc */ public function __get($name) { /** * Ensure there is always a corresponding Content */ if ($name == 'content') { $content = parent::__get('content'); if (!$this->isRelationPopulated('content') || $content === null) { $content = new Content(); $this->populateRelation('content', $content); $content->setPolymorphicRelation($this); } return $content; } return parent::__get($name); }