protected function getJoinKeys(Relation $relation)
    {
        if ($relation instanceof MorphTo) {
            throw new LogicException("MorphTo relation cannot be joined.");
        }

        if ($relation instanceof HasOneOrMany) {
            return [$relation->getQualifiedForeignKeyName(), $relation->getQualifiedParentKeyName()];
        }

        if ($relation instanceof BelongsTo) {
            return [$relation->getQualifiedForeignKeyName(), $relation->getQualifiedOwnerKeyName()];
        }

        if ($relation instanceof BelongsToMany) {
            return [$relation->getQualifiedRelatedPivotKeyName(), $relation->getRelated()->getQualifiedKeyName()];
        }

        if ($relation instanceof HasManyThrough) {
            $fk = $relation->getQualifiedFarKeyName();

            return [$fk, $relation->getParent()->getQualifiedKeyName()];
        }
    }
protected function getJoinKeys(Relation $relation)
    {
        if ($relation instanceof MorphTo) {
            throw new LogicException("MorphTo relation cannot be joined.");
        }

        if ($relation instanceof HasOneOrMany) {
            return [$relation->getQualifiedForeignKeyName(), $relation->getQualifiedParentKeyName()];
        }

        if ($relation instanceof BelongsTo) {
            return [$relation->getQualifiedForeignKeyName(), $relation->getQualifiedOwnerKeyName()];
        }

        if ($relation instanceof BelongsToMany) {
            return [$relation->getQualifiedRelatedPivotKeyName(), $relation->getRelated()->getQualifiedKeyName()];
        }

        if ($relation instanceof HasManyThrough) {
            $fk = $relation->getQualifiedFarKeyName();

            return [$fk, $relation->getParent()->getQualifiedKeyName()];
        }
    }
protected function getJoinKeys ( Relation $ relation ) { if ( $ relation instanceof MorphTo ) { throw new LogicException ( "MorphTo relation cannot be joined." ) ; } if ( $ relation instanceof HasOneOrMany ) { return [ $ relation -> getQualifiedForeignKeyName ( ) , $ relation -> getQualifiedParentKeyName ( ) ] ; } if ( $ relation instanceof BelongsTo ) { return [ $ relation -> getQualifiedForeignKeyName ( ) , $ relation -> getQualifiedOwnerKeyName ( ) ] ; } if ( $ relation instanceof BelongsToMany ) { return [ $ relation -> getQualifiedRelatedPivotKeyName ( ) , $ relation -> getRelated ( ) -> getQualifiedKeyName ( ) ] ; } if ( $ relation instanceof HasManyThrough ) { $ fk = $ relation -> getQualifiedFarKeyName ( ) ; return [ $ fk , $ relation -> getParent ( ) -> getQualifiedKeyName ( ) ] ; } }
Get pair of the keys from relation in order to join the table.

@param  \Illuminate\Database\Eloquent\Relations\Relation $relation
@return array

@throws \LogicException
Get pair of the keys from relation in order to join the table .