src/HasRelationships.php
protected function hasOneOrManyDeep($related, array $through, array $foreignKeys, array $localKeys)
    {
        /** @var \Illuminate\Database\Eloquent\Model $relatedInstance */
        $relatedInstance = $this->newRelatedInstance($related);

        $throughParents = $this->hasOneOrManyDeepThroughParents($through);

        $foreignKeys = $this->hasOneOrManyDeepForeignKeys($relatedInstance, $throughParents, $foreignKeys);

        $localKeys = $this->hasOneOrManyDeepLocalKeys($relatedInstance, $throughParents, $localKeys);

        return [$relatedInstance->newQuery(), $this, $throughParents, $foreignKeys, $localKeys];
    }
protected function hasOneOrManyDeep($related, array $through, array $foreignKeys, array $localKeys)
    {
        /** @var \Illuminate\Database\Eloquent\Model $relatedInstance */
        $relatedInstance = $this->newRelatedInstance($related);

        $throughParents = $this->hasOneOrManyDeepThroughParents($through);

        $foreignKeys = $this->hasOneOrManyDeepForeignKeys($relatedInstance, $throughParents, $foreignKeys);

        $localKeys = $this->hasOneOrManyDeepLocalKeys($relatedInstance, $throughParents, $localKeys);

        return [$relatedInstance->newQuery(), $this, $throughParents, $foreignKeys, $localKeys];
    }
protected function hasOneOrManyDeep ( $ related , array $ through , array $ foreignKeys , array $ localKeys ) { /** @var \Illuminate\Database\Eloquent\Model $relatedInstance */ $ relatedInstance = $ this -> newRelatedInstance ( $ related ) ; $ throughParents = $ this -> hasOneOrManyDeepThroughParents ( $ through ) ; $ foreignKeys = $ this -> hasOneOrManyDeepForeignKeys ( $ relatedInstance , $ throughParents , $ foreignKeys ) ; $ localKeys = $ this -> hasOneOrManyDeepLocalKeys ( $ relatedInstance , $ throughParents , $ localKeys ) ; return [ $ relatedInstance -> newQuery ( ) , $ this , $ throughParents , $ foreignKeys , $ localKeys ] ; }
Prepare a has-one-deep or has-many-deep relationship.

@param  string  $related
@param  array  $through
@param  array  $foreignKeys
@param  array  $localKeys
@return array
Prepare a has - one - deep or has - many - deep relationship .