@@ -21,8 +21,9 @@ __Contents:__
21
21
- [ Documentation] ( #documentation )
22
22
- [ Inserting nodes] ( #inserting-nodes )
23
23
- [ Retrieving nodes] ( #retrieving-nodes )
24
- - [ Scoping ] ( #scoping )
24
+ - [ Deleting nodes ] ( #deleting-nodes )
25
25
- [ Consistency checking & fixing] ( #checking-consistency )
26
+ - [ Scoping] ( #scoping )
26
27
- [ Requirements] ( #requirements )
27
28
- [ Installation] ( #installation )
28
29
@@ -189,6 +190,9 @@ $node = Category::create([
189
190
190
191
#### Ancestors
191
192
193
+ Ancestors make a chain of parents to the node. Helpful for displaying breadcrumbs
194
+ to the current category.
195
+
192
196
``` php
193
197
// #1 Using accessor
194
198
$result = $node->getAncestors();
@@ -202,6 +206,9 @@ $result = Category::ancestorsOf($id);
202
206
203
207
#### Descendants
204
208
209
+ Descendants are all nodes in a sub tree, i.e. children of node, children of
210
+ children, etc.
211
+
205
212
``` php
206
213
// #1 Using relationship
207
214
$result = $node->descendants;
@@ -213,8 +220,16 @@ $result = $node->descendants()->get();
213
220
$result = Category::descendantsOf($id);
214
221
```
215
222
223
+ Descendants can be eagerly loaded:
224
+
225
+ ``` php
226
+ $nodes = Category::with('descendants')->whereIn('id', $idList)->get();
227
+ ```
228
+
216
229
#### Siblings
217
230
231
+ Siblings are nodes that have same parent.
232
+
218
233
``` php
219
234
$result = $node->getSiblings();
220
235
@@ -374,7 +389,7 @@ This will output something like this:
374
389
- Another root
375
390
```
376
391
377
- ##### Getting subtree
392
+ ##### Getting a subtree
378
393
379
394
Sometimes you don't need whole tree to be loaded and just some subtree of specific node.
380
395
It is show in following example:
0 commit comments