File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -195,26 +195,29 @@ if ($sibling = $node->nextSiblings()->first())
195195}
196196```
197197
198- Moving up is a little bit trickier :
198+ Moving up is similar :
199199
200200``` php
201- if ($sibling = $node->prevSiblings()->reversed()-> first())
201+ if ($sibling = $node->prevSiblings()->first())
202202{
203203 $node->before($sibling)->save();
204204}
205205```
206206
207- To move node up we need to insert it before node that is right at the top of it.
208- If we use ` $node->prevSiblings()->first() ` we'll get the first child of the parent
209- since all nodes are ordered by fixed values. We apply ` reversed() ` scope to reverse
210- default order.
211-
212207## Advanced usage
213208
214209### Default order
215210
216211Nodes are ordered by lft column unless there is ` limit ` or ` offset ` is provided,
217- or when user uses ` orderBy ` .
212+ or when user uses ` orderBy() ` .
213+
214+ Reversed order can be applied using ` reversed() ` scope. When using ` prevSiblings() `
215+ or ` prev() ` reversed order is aplied by default. To use the default order, use
216+ ` defaultOrder() ` scope:
217+
218+ ``` php
219+ $siblings = $node->prevSiblings()->defaultOrder()->get();
220+ ```
218221
219222### Custom collection
220223
You can’t perform that action at this time.
0 commit comments