newNestedSetQuery() public method

Get a new "scoped" query builder for the Node's model.
public newNestedSetQuery ( ) : Builder | static
return Illuminate\Database\Eloquent\Builder | static
Example #1
0
 protected function pruneScope()
 {
     if ($this->node->exists) {
         return $this->node->descendants();
     }
     return $this->node->newNestedSetQuery();
 }
Example #2
0
File: Move.php Project: yajra/baum
 /**
  * Computes the boundary.
  *
  * @return int
  */
 protected function bound1()
 {
     if (!is_null($this->_bound1)) {
         return $this->_bound1;
     }
     switch ($this->position) {
         case 'child':
             $this->_bound1 = $this->target->getRight();
             break;
         case 'left':
             $this->_bound1 = $this->target->getLeft();
             break;
         case 'right':
             $this->_bound1 = $this->target->getRight() + 1;
             break;
         case 'root':
             $this->_bound1 = $this->node->newNestedSetQuery()->max($this->node->getRightColumnName()) + 1;
             break;
     }
     $this->_bound1 = $this->_bound1 > $this->node->getRight() ? $this->_bound1 - 1 : $this->_bound1;
     return $this->_bound1;
 }