/** * Lists all Menu models. * @return mixed */ public function actionIndex() { $searchModel = new MenuSearch(); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams()); return $this->render('index', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]); }
public function getMenus($pid = null) { $menus = Menu::find()->where(['parent' => $pid])->orderBy('order asc')->all(); return $menus; }
</ul> </div> </div> </div> <!-- END TOPBAR --> <!-- START CONTAINER --> <div class="page-container row-fluid"> <!-- SIDEBAR - START --> <div class="page-sidebar"> <!-- MAIN MENU - START --> <div class="page-sidebar-wrapper" id="main-menu-wrapper"> <?php $searchModel = new MenuSearch(); $menus = $searchModel->getMenus(); ?> <ul class='wraplist'> <?php foreach ($menus as $i => $menu) { ?> <li class=""> <a <?php if ($menu->route) { echo "id='menu_1_{$menu->id}' href='{$menu->route}'"; } else { echo 'href="javascript:;"'; } ?> href="<?php