Baum\Node::newNestedSetQuery PHP Method

newNestedSetQuery() public method

Get a new "scoped" query builder for the Node's model.
public newNestedSetQuery ( ) : Builder | static
return Illuminate\Database\Eloquent\Builder | static
    public function newNestedSetQuery()
    {
        $builder = $this->newQuery()->orderBy($this->getQualifiedOrderColumnName());
        if ($this->isScoped()) {
            foreach ($this->scoped as $scopeFld) {
                $builder->where($scopeFld, '=', $this->{$scopeFld});
            }
        }
        return $builder;
    }

Usage Example

Example #1
0
 protected function pruneScope()
 {
     if ($this->node->exists) {
         return $this->node->descendants();
     }
     return $this->node->newNestedSetQuery();
 }
All Usage Examples Of Baum\Node::newNestedSetQuery