Esensi\Model\Traits\RelatingModelTrait::getDynamicRelationship PHP Method

getDynamicRelationship() protected method

Get a dynamically resolved relationship.
protected getDynamicRelationship ( string $name ) : mixed
$name string
return mixed
    protected function getDynamicRelationship($name)
    {
        // Dynamically get the relationship
        if ($this->isRelationship($name)) {
            // Use the relationship already loaded
            if (array_key_exists($name, $this->getRelations())) {
                return $this->getRelation($name);
            }
            // Load the relationship
            return $this->getRelationshipFromMethod($name, camel_case($name));
        }
    }