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();
}