When using withoutNode(node) to fetch a tree, this method will filter out individual nodes, but will leave the descendants of those nodes in the list, kind of "broken" without parents. I am looking for a way to "prune" a tree from the selected tree, so a whole branch and all descendants are not in that list.
I cannot see a way to do this with the built-in methods, but I could just be missing it. Is that the case?
This is how I am working around this at the moment:
Here, $prune is a node that I am editing, and wish to give the user in the admin screen another node to set as a parent for this node. So in this case, the node can be placed anywhere on the tree except on itself, or on any of its current descendants. This gives me that list.
I'm using a root slug here to limit this tree, but you may just take the complete nested set for the whole table - makes no odds. The key is excluding the $prune node and everything under it.
Is this already supported, perhaps in a scope (allowing multiple branches to be pruned in the database selection) or does it need a PR ;-)
When using
withoutNode(node)
to fetch a tree, this method will filter out individual nodes, but will leave the descendants of those nodes in the list, kind of "broken" without parents. I am looking for a way to "prune" a tree from the selected tree, so a whole branch and all descendants are not in that list.I cannot see a way to do this with the built-in methods, but I could just be missing it. Is that the case?
This is how I am working around this at the moment:
Here,
$prune
is a node that I am editing, and wish to give the user in the admin screen another node to set as a parent for this node. So in this case, the node can be placed anywhere on the tree except on itself, or on any of its current descendants. This gives me that list.I'm using a root slug here to limit this tree, but you may just take the complete nested set for the whole table - makes no odds. The key is excluding the
$prune
node and everything under it.Is this already supported, perhaps in a scope (allowing multiple branches to be pruned in the database selection) or does it need a PR ;-)