protected function joinBelongsToMany(BelongsToMany $relation)
    {
        return $this->instance->join(
            $relation->getTable(),
            $relation->getParent()->getTable() . '.' . $relation->getParent()->getKeyName(),
            '=',
            $relation->getForeignKey()
        )->join(
            $relation->getRelated()->getTable(),
            $relation->getRelated()->getTable() . '.' . $relation->getRelated()->getKeyName(),
            '=',
            $relation->getOtherKey()
        );
    }
protected function joinBelongsToMany(BelongsToMany $relation)
    {
        return $this->instance->join(
            $relation->getTable(),
            $relation->getParent()->getTable() . '.' . $relation->getParent()->getKeyName(),
            '=',
            $relation->getForeignKey()
        )->join(
            $relation->getRelated()->getTable(),
            $relation->getRelated()->getTable() . '.' . $relation->getRelated()->getKeyName(),
            '=',
            $relation->getOtherKey()
        );
    }
protected function joinBelongsToMany ( BelongsToMany $ relation ) { return $ this -> instance -> join ( $ relation -> getTable ( ) , $ relation -> getParent ( ) -> getTable ( ) . '.' . $ relation -> getParent ( ) -> getKeyName ( ) , '=' , $ relation -> getForeignKey ( ) ) -> join ( $ relation -> getRelated ( ) -> getTable ( ) , $ relation -> getRelated ( ) -> getTable ( ) . '.' . $ relation -> getRelated ( ) -> getKeyName ( ) , '=' , $ relation -> getOtherKey ( ) ) ; }
Join a belongs to many relationship.

@param BelongsToMany $relation

@return mixed
Join a belongs to many relationship .