render('footer', [ 'footer_navigation' => $this->retrieveNavigation('footer'), 'footer_2_navigation' => $this->retrieveNavigation('footer_2'), 'footer_3_navigation' => $this->retrieveNavigation('footer_3'), ]); } private function retrieveNavigation($menu_type) { //return []; $nav = Navigation::find() ->where(['is_active' => 1]) ->andWhere(['IN', 'menu_type', ['footer', 'footer_2', 'footer_3']]) ->orderBy(['order_index' => SORT_ASC])->all(); $navigation = []; foreach ($nav as $item) { $navigation[$item->menu_type][] = $item; } return $navigation[$menu_type] ?? []; } }