/** * Returns the related records of the given model. * * @param string $type * @return mixed */ public function getRelatedRecords($type) { if ($rel = $this->definition->getRelationship($type)) { return $rel->getRelatedRecords($this); } }