protected function validateBounds()
	{
		$connection = $this->model->getConnection();
		$grammar = $connection->getQueryGrammar();

		$tableName = $this->model->getTable();
		$primaryKeyName = $this->model->getKeyName();
		$parentColumn = $this->model->getQualifiedParentColumnName();

		$lftCol = $grammar->wrap( $this->model->getLeftColumnName() );
		$rgtCol = $grammar->wrap( $this->model->getRightColumnName() );

		$qualifiedLftCol = $grammar->wrap( $this->model->getQualifiedLeftColumnName() );
		$qualifiedRgtCol = $grammar->wrap( $this->model->getQualifiedRightColumnName() );
		$qualifiedParentCol = $grammar->wrap( $this->model->getQualifiedParentColumnName() );

		$whereStm = "($qualifiedLftCol IS NULL OR
      $qualifiedRgtCol IS NULL OR
      $qualifiedLftCol >= $qualifiedRgtCol OR
      ($qualifiedParentCol IS NOT NULL AND
        ($qualifiedLftCol <= parent.$lftCol OR
          $qualifiedRgtCol >= parent.$rgtCol)))";

		$query = $this->model->newQuery()->join( $connection->raw( $grammar->wrapTable( $tableName ) . ' AS parent' ), $parentColumn, '=', $connection->raw( 'parent.' . $grammar->wrap( $primaryKeyName ) ), 'left outer' )->whereRaw( $whereStm );

		return ( $query->count() == 0 );
	}
protected function validateBounds()
	{
		$connection = $this->model->getConnection();
		$grammar = $connection->getQueryGrammar();

		$tableName = $this->model->getTable();
		$primaryKeyName = $this->model->getKeyName();
		$parentColumn = $this->model->getQualifiedParentColumnName();

		$lftCol = $grammar->wrap( $this->model->getLeftColumnName() );
		$rgtCol = $grammar->wrap( $this->model->getRightColumnName() );

		$qualifiedLftCol = $grammar->wrap( $this->model->getQualifiedLeftColumnName() );
		$qualifiedRgtCol = $grammar->wrap( $this->model->getQualifiedRightColumnName() );
		$qualifiedParentCol = $grammar->wrap( $this->model->getQualifiedParentColumnName() );

		$whereStm = "($qualifiedLftCol IS NULL OR
      $qualifiedRgtCol IS NULL OR
      $qualifiedLftCol >= $qualifiedRgtCol OR
      ($qualifiedParentCol IS NOT NULL AND
        ($qualifiedLftCol <= parent.$lftCol OR
          $qualifiedRgtCol >= parent.$rgtCol)))";

		$query = $this->model->newQuery()->join( $connection->raw( $grammar->wrapTable( $tableName ) . ' AS parent' ), $parentColumn, '=', $connection->raw( 'parent.' . $grammar->wrap( $primaryKeyName ) ), 'left outer' )->whereRaw( $whereStm );

		return ( $query->count() == 0 );
	}
protected function validateBounds ( ) { $ connection = $ this -> model -> getConnection ( ) ; $ grammar = $ connection -> getQueryGrammar ( ) ; $ tableName = $ this -> model -> getTable ( ) ; $ primaryKeyName = $ this -> model -> getKeyName ( ) ; $ parentColumn = $ this -> model -> getQualifiedParentColumnName ( ) ; $ lftCol = $ grammar -> wrap ( $ this -> model -> getLeftColumnName ( ) ) ; $ rgtCol = $ grammar -> wrap ( $ this -> model -> getRightColumnName ( ) ) ; $ qualifiedLftCol = $ grammar -> wrap ( $ this -> model -> getQualifiedLeftColumnName ( ) ) ; $ qualifiedRgtCol = $ grammar -> wrap ( $ this -> model -> getQualifiedRightColumnName ( ) ) ; $ qualifiedParentCol = $ grammar -> wrap ( $ this -> model -> getQualifiedParentColumnName ( ) ) ; $ whereStm = "($qualifiedLftCol IS NULL OR
      $qualifiedRgtCol IS NULL OR
      $qualifiedLftCol >= $qualifiedRgtCol OR
      ($qualifiedParentCol IS NOT NULL AND
        ($qualifiedLftCol <= parent.$lftCol OR
          $qualifiedRgtCol >= parent.$rgtCol)))" ; $ query = $ this -> model -> newQuery ( ) -> join ( $ connection -> raw ( $ grammar -> wrapTable ( $ tableName ) . ' AS parent' ) , $ parentColumn , '=' , $ connection -> raw ( 'parent.' . $ grammar -> wrap ( $ primaryKeyName ) ) , 'left outer' ) -> whereRaw ( $ whereStm ) ; return ( $ query -> count ( ) == 0 ) ; }
Validates bounds of the nested tree structure. It will perform checks on
the `lft`, `rgt` and `parent_id` columns. Mainly that they're not null,
rights greater than lefts, and that they're within the bounds of the parent.

@return boolean
Validates bounds of the nested tree structure . It will perform checks on the lft rgt and parent_id columns . Mainly that they re not null rights greater than lefts and that they re within the bounds of the parent .