Total Complexity | 3 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
9 | class MenuController extends Controller |
||
10 | { |
||
11 | public function index() |
||
12 | { |
||
13 | $menus = Menu::all(); |
||
14 | |||
15 | // If there is only one menu, we will show the menu immediately. |
||
16 | if ($menus->count() == 1) { |
||
17 | return $this->show($menus->first()->key()); |
||
18 | } |
||
19 | |||
20 | return view('chief::back.menu.index', [ |
||
21 | 'menus' => $menus |
||
22 | ]); |
||
23 | } |
||
24 | |||
25 | public function show($type) |
||
26 | { |
||
27 | $menu = Menu::find($type); |
||
28 | |||
29 | return view('chief::back.menu.show', [ |
||
30 | 'menuItems' => ChiefMenu::fromMenuItems($type)->includeHidden()->items(), |
||
31 | 'menu' => $menu, |
||
32 | ]); |
||
35 |