protected function getJoinClause(Model $parent, Relation $relation, $table, $type)
    {
        list($fk, $pk) = $this->getJoinKeys($relation);

        $join = (new Join($this->query, $type, $table))->on($fk, '=', $pk);

        if (in_array(SoftDeletes::class, class_uses_recursive($relation->getRelated()))) {
            $join->whereNull($relation->getRelated()->getQualifiedDeletedAtColumn());
        }

        if ($relation instanceof MorphOneOrMany) {
            $join->where($relation->getQualifiedMorphType(), '=', $parent->getMorphClass());
        } elseif ($relation instanceof MorphToMany || $relation instanceof MorphByMany) {
            $join->where($relation->getMorphType(), '=', $parent->getMorphClass());
        }

        return $join;
    }
protected function getJoinClause(Model $parent, Relation $relation, $table, $type)
    {
        list($fk, $pk) = $this->getJoinKeys($relation);

        $join = (new Join($this->query, $type, $table))->on($fk, '=', $pk);

        if (in_array(SoftDeletes::class, class_uses_recursive($relation->getRelated()))) {
            $join->whereNull($relation->getRelated()->getQualifiedDeletedAtColumn());
        }

        if ($relation instanceof MorphOneOrMany) {
            $join->where($relation->getQualifiedMorphType(), '=', $parent->getMorphClass());
        } elseif ($relation instanceof MorphToMany || $relation instanceof MorphByMany) {
            $join->where($relation->getMorphType(), '=', $parent->getMorphClass());
        }

        return $join;
    }
protected function getJoinClause ( Model $ parent , Relation $ relation , $ table , $ type ) { list ( $ fk , $ pk ) = $ this -> getJoinKeys ( $ relation ) ; $ join = ( new Join ( $ this -> query , $ type , $ table ) ) -> on ( $ fk , '=' , $ pk ) ; if ( in_array ( SoftDeletes :: class , class_uses_recursive ( $ relation -> getRelated ( ) ) ) ) { $ join -> whereNull ( $ relation -> getRelated ( ) -> getQualifiedDeletedAtColumn ( ) ) ; } if ( $ relation instanceof MorphOneOrMany ) { $ join -> where ( $ relation -> getQualifiedMorphType ( ) , '=' , $ parent -> getMorphClass ( ) ) ; } elseif ( $ relation instanceof MorphToMany || $ relation instanceof MorphByMany ) { $ join -> where ( $ relation -> getMorphType ( ) , '=' , $ parent -> getMorphClass ( ) ) ; } return $ join ; }
Get the join clause for related table.

@param  \Illuminate\Database\Eloquent\Model $parent
@param  \Illuminate\Database\Eloquent\Relations\Relation $relation
@param  string $type
@param  string $table
@return \Illuminate\Database\Query\JoinClause
Get the join clause for related table .