By implementing the polymorph method it is possible to retrieve an
ArticleContent or a VideoContent object object by simply querying
within the Content model using first, find, where or all.
Example:
public function polymorph()
{
if ($this->video != null) {
$obj = new VideoContent;
$obj->fill($this->attributes);
return $obj;
} else {
return $this;
}
}
In the example above, if you call Content::first() and the content
returned have the key video set, then the object returned will be
a VideoContent instead of a Content.