I can not understand how to fill the submenu in yii2 with data, I see that it is formed like this. It is logical to have two tables parentMenu (t1) and chaildMenu (t2) in t1 foreign key -> (t1) chaild_id and in t2 (parent_id) and somehow select with one query or two, but it's not clear how to form an array, in general, it is completely confused, tell me how to do?
$menuItems = [ ['label' => 'HOME', 'url' => ['/site/index']], ['label' => 'INFO', 'items' => [ ['label' => 'About US', 'url' => ['/about-us/index']], ['label' => 'The Game', 'url' => ['/the-game/index']], ]], ['label' => 'PRICES', 'url' => ['/site/prices']], ['label' => 'FOO', 'items' => [ ['label' => 'Foo', 'url' => ['/foo/index']], I only get a one-level menu from one table, but I cannot understand how to make it from two.
`$items = Menu::find()->all(); foreach ($items as $item) { $result[] = [ 'label' => $item->title, 'url' => [$item->url], ]; } return $result;