laravel-nestedset
laravel-nestedset copied to clipboard
Ordering nodes by children or descendants count ?
Hello.
I am wondering if it is possible to order nodes by number of children or descendants count ?
I have a list of organizations that belong to a head organization, but I would like to order the children by order of subsidiaries they possess.
Ex : Output from DB :
Main organization ----- Child one ---------- Grandchild one ---------- Grandchild two ----- Child two ---------- Grandchild three ---------- Grandchild four ---------- Grandchild five
I would like to display the array as such :
Main organization ----- Child two ---------- Grandchild three ---------- Grandchild four ---------- Grandchild five ----- Child one ---------- Grandchild one ---------- Grandchild two
Thanks a lot.