src/Eloquent/Model.php
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;
    }
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;
    }
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 ; }
Get the relation value setting the connection name.

@param string $key
@return mixed
Get the relation value setting the connection name .