src/ConcatenatesRelationships.php
protected function hasOneOrManyDeepFromHasManyThrough(HasManyThrough $relation, array $through, array $foreignKeys, array $localKeys)
    {
        $through[] = get_class($relation->getParent());

        $foreignKeys[] = $relation->getFirstKeyName();
        $foreignKeys[] = $relation->getForeignKeyName();

        $localKeys[] = $relation->getLocalKeyName();
        $localKeys[] = $relation->getSecondLocalKeyName();

        return [$through, $foreignKeys, $localKeys];
    }
protected function hasOneOrManyDeepFromHasManyThrough(HasManyThrough $relation, array $through, array $foreignKeys, array $localKeys)
    {
        $through[] = get_class($relation->getParent());

        $foreignKeys[] = $relation->getFirstKeyName();
        $foreignKeys[] = $relation->getForeignKeyName();

        $localKeys[] = $relation->getLocalKeyName();
        $localKeys[] = $relation->getSecondLocalKeyName();

        return [$through, $foreignKeys, $localKeys];
    }
protected function hasOneOrManyDeepFromHasManyThrough ( HasManyThrough $ relation , array $ through , array $ foreignKeys , array $ localKeys ) { $ through [ ] = get_class ( $ relation -> getParent ( ) ) ; $ foreignKeys [ ] = $ relation -> getFirstKeyName ( ) ; $ foreignKeys [ ] = $ relation -> getForeignKeyName ( ) ; $ localKeys [ ] = $ relation -> getLocalKeyName ( ) ; $ localKeys [ ] = $ relation -> getSecondLocalKeyName ( ) ; return [ $ through , $ foreignKeys , $ localKeys ] ; }
Prepare a has-one-deep or has-many-deep relationship from an existing has-many-through relationship.

@param  \Illuminate\Database\Eloquent\Relations\HasManyThrough  $relation
@param  \Illuminate\Database\Eloquent\Model[]  $through
@param  array  $foreignKeys
@param  array  $localKeys
@return array
Prepare a has - one - deep or has - many - deep relationship from an existing has - many - through relationship .