我有一些問題與嵌套集合到下拉...組嵌套的JSON在laravel
當我這樣做:
$selects = Category::defaultOrder()->withDepth()->get()->toTree();
我得到這個JSON:https://pastebin.com/Cw4TbWyA
我想什麼有:
Collection {#196 ▼
#items: array:7 [▼
1 => "123"
4 => "- test2"
6 => "- test4"
2 => "1234"
5 => "- test3"
7 => "-- testtest"
3 => "test1"
]
}
或任何其他方式來正確填寫下拉菜單。如果有幫助,我使用laravel。