Corcel\Model::getRelationValue PHP Method

getRelationValue() public method

Get the relation value setting the connection name
public getRelationValue ( string $key ) : mixed
$key string
return mixed
    public function getRelationValue($key)
    {
        $relation = parent::getRelationValue($key);
        if ($relation instanceof Collection) {
            $relation->each(function ($model) {
                $this->setRelationConnection($model);
            });
            return $relation;
        }
        $this->setRelationConnection($relation);
        return $relation;
    }