Baum\SetBuilder::children PHP Method

children() public method

Return all children for the specified node.
public children ( Baum\Node $node ) : Illuminate\Database\Eloquent\Collection
$node Baum\Node
return Illuminate\Database\Eloquent\Collection
    public function children($node)
    {
        $query = $this->node->newQuery();
        $query->where($this->node->getQualifiedParentColumnName(), '=', $node->getKey());
        // We must also add the scoped column values to the query to compute valid
        // left and right indexes.
        foreach ($this->scopedAttributes($node) as $fld => $value) {
            $query->where($this->qualify($fld), '=', $value);
        }
        $query->orderBy($this->node->getQualifiedLeftColumnName());
        $query->orderBy($this->node->getQualifiedRightColumnName());
        $query->orderBy($this->node->getQualifiedKeyName());
        return $query->get();
    }