|
|
@@ -152,13 +152,14 @@ class Menu extends Controller
|
|
|
$result = MenuService::findAll($search);
|
|
|
$result = $result->toArray();
|
|
|
$result = list_to_tree($result);
|
|
|
- $result = $this->treeToList($result);
|
|
|
-
|
|
|
+ $newArr = [];
|
|
|
+ $this->treeToList($result,$newArr);
|
|
|
+ $result = $newArr;
|
|
|
return $this->success($result);
|
|
|
}
|
|
|
|
|
|
|
|
|
- private function treeToList($result, $newArr = [])
|
|
|
+ private function treeToList($result, &$newArr = [])
|
|
|
{
|
|
|
foreach ($result as $item) {
|
|
|
$data = $item;
|
|
|
@@ -168,7 +169,6 @@ class Menu extends Controller
|
|
|
$this->treeToList($item['children'], $newArr);
|
|
|
}
|
|
|
}
|
|
|
- return $newArr;
|
|
|
}
|
|
|
|
|
|
|