original_string: public function getRelationExistenceQueryForThroughSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*'])
      {
          $table = $this->throughParent->getTable().' as '.$hash = $this->getRelationCountHash();
  
          $query->join($table, $hash.'.'.$this->secondLocalKey, '=', $this->getQualifiedFarKeyName());
  
          if ($this->throughParentSoftDeletes()) {
              $query->whereNull($hash.'.'.$this->throughParent->getDeletedAtColumn());
          }
  
          return $query->select($columns)->whereColumn(
              $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $hash.'.'.$this->firstKey
          );
      }
code: public function getRelationExistenceQueryForThroughSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*'])
      {
          $table = $this->throughParent->getTable().' as '.$hash = $this->getRelationCountHash();
  
          $query->join($table, $hash.'.'.$this->secondLocalKey, '=', $this->getQualifiedFarKeyName());
  
          if ($this->throughParentSoftDeletes()) {
              $query->whereNull($hash.'.'.$this->throughParent->getDeletedAtColumn());
          }
  
          return $query->select($columns)->whereColumn(
              $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $hash.'.'.$this->firstKey
          );
      }
code_tokens: public function getRelationExistenceQueryForThroughSelfRelation ( Builder $ query , Builder $ parentQuery , $ columns = [ '*' ] ) { $ table = $ this -> throughParent -> getTable ( ) . ' as ' . $ hash = $ this -> getRelationCountHash ( ) ; $ query -> join ( $ table , $ hash . '.' . $ this -> secondLocalKey , '=' , $ this -> getQualifiedFarKeyName ( ) ) ; if ( $ this -> throughParentSoftDeletes ( ) ) { $ query -> whereNull ( $ hash . '.' . $ this -> throughParent -> getDeletedAtColumn ( ) ) ; } return $ query -> select ( $ columns ) -> whereColumn ( $ parentQuery -> getQuery ( ) -> from . '.' . $ this -> localKey , '=' , $ hash . '.' . $ this -> firstKey ) ; }
docstring: Add the constraints for a relationship query on the same table as the through parent.
  
  @param  \Illuminate\Database\Eloquent\Builder  $query
  @param  \Illuminate\Database\Eloquent\Builder  $parentQuery
  @param  array|mixed  $columns
  @return \Illuminate\Database\Eloquent\Builder
docstring_tokens: Add the constraints for a relationship query on the same table as the through parent .