Skip to content

Commit 977f0ef

Browse files
committed
readme updated
1 parent d5b5d08 commit 977f0ef

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,16 @@ Model::orderBy('parent_id')->get()->nest();
2929
```
3030

3131
Of course you will probably want a position column as well. So you will have to order first by parent_id asc and then by position asc.
32+
33+
## Indented and flattened list
34+
35+
```listsFlattened()``` method generate the tree as a flattened list with id as keys and title as values, perfect for select/option, for example :
36+
37+
```php
38+
[
39+
'22' => 'Item 1 Title',
40+
'10' => ' Child 1 Title',
41+
'17' => ' Child 2 Title',
42+
'14' => 'Item 2 Title',
43+
]
44+
```

0 commit comments

Comments
 (0)