@@ -21,8 +21,9 @@ __Contents:__
2121- [ Documentation] ( #documentation )
2222 - [ Inserting nodes] ( #inserting-nodes )
2323 - [ Retrieving nodes] ( #retrieving-nodes )
24- - [ Scoping ] ( #scoping )
24+ - [ Deleting nodes ] ( #deleting-nodes )
2525 - [ Consistency checking & fixing] ( #checking-consistency )
26+ - [ Scoping] ( #scoping )
2627- [ Requirements] ( #requirements )
2728- [ Installation] ( #installation )
2829
@@ -189,6 +190,9 @@ $node = Category::create([
189190
190191#### Ancestors
191192
193+ Ancestors make a chain of parents to the node. Helpful for displaying breadcrumbs
194+ to the current category.
195+
192196``` php
193197// #1 Using accessor
194198$result = $node->getAncestors();
@@ -202,6 +206,9 @@ $result = Category::ancestorsOf($id);
202206
203207#### Descendants
204208
209+ Descendants are all nodes in a sub tree, i.e. children of node, children of
210+ children, etc.
211+
205212``` php
206213// #1 Using relationship
207214$result = $node->descendants;
@@ -213,8 +220,16 @@ $result = $node->descendants()->get();
213220$result = Category::descendantsOf($id);
214221```
215222
223+ Descendants can be eagerly loaded:
224+
225+ ``` php
226+ $nodes = Category::with('descendants')->whereIn('id', $idList)->get();
227+ ```
228+
216229#### Siblings
217230
231+ Siblings are nodes that have same parent.
232+
218233``` php
219234$result = $node->getSiblings();
220235
@@ -374,7 +389,7 @@ This will output something like this:
374389- Another root
375390```
376391
377- ##### Getting subtree
392+ ##### Getting a subtree
378393
379394Sometimes you don't need whole tree to be loaded and just some subtree of specific node.
380395It is show in following example:
0 commit comments