@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $this->addHeader($this->app->title); |
| 20 | 20 | |
| 21 | 21 | $items = collect(); |
| 22 | - foreach(NavMenuJoint::collect() as $joint) { |
|
| 22 | + foreach (NavMenuJoint::collect() as $joint) { |
|
| 23 | 23 | $items = $items->merge($joint->items()); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public static function addItems($menu, Collection $items) |
| 38 | 38 | { |
| 39 | - $items->sort(function ($entry1, $entry2) { |
|
| 39 | + $items->sort(function($entry1, $entry2) { |
|
| 40 | 40 | $weight1 = $entry1['weight']?? 10; |
| 41 | 41 | $weight2 = $entry2['weight']?? 10; |
| 42 | 42 | |
| 43 | 43 | return $weight1 <=> $weight2; |
| 44 | 44 | })->map(function($item, $caption) use ($menu) { |
| 45 | - if (! ($item['access']?? true)) return; |
|
| 45 | + if (!($item['access']?? true)) return; |
|
| 46 | 46 | |
| 47 | 47 | if (!isset($item['link']) && !is_array($item)) { |
| 48 | 48 | $item = [ |
@@ -42,7 +42,9 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | return $weight1 <=> $weight2; |
| 44 | 44 | })->map(function($item, $caption) use ($menu) { |
| 45 | - if (! ($item['access']?? true)) return; |
|
| 45 | + if (! ($item['access']?? true)) { |
|
| 46 | + return; |
|
| 47 | + } |
|
| 46 | 48 | |
| 47 | 49 | if (!isset($item['link']) && !is_array($item)) { |
| 48 | 50 | $item = [ |
@@ -60,8 +62,7 @@ discard block |
||
| 60 | 62 | $submenu = $menu->addMenu($item['caption']); |
| 61 | 63 | |
| 62 | 64 | self::addItems($submenu, collect($subitems)); |
| 63 | - } |
|
| 64 | - elseif ($subitems = $item['group']?? []) { |
|
| 65 | + } elseif ($subitems = $item['group']?? []) { |
|
| 65 | 66 | $subgroup = $menu->addGroup($item['caption']); |
| 66 | 67 | |
| 67 | 68 | if (($item['toggle']?? false) && !$menu->in_dropdown) { |
@@ -70,8 +71,7 @@ discard block |
||
| 70 | 71 | } |
| 71 | 72 | |
| 72 | 73 | self::addItems($subgroup, collect($subitems)); |
| 73 | - } |
|
| 74 | - elseif ($subitems = $item['accordion']?? []) { |
|
| 74 | + } elseif ($subitems = $item['accordion']?? []) { |
|
| 75 | 75 | $accordion = $menu->add(['Accordion']); |
| 76 | 76 | |
| 77 | 77 | $section = $accordion->addSection($item['caption']); |
@@ -94,12 +94,10 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | // self::addItems($accordion, collect($subitems)); |
| 97 | - } |
|
| 98 | - else { |
|
| 97 | + } else { |
|
| 99 | 98 | if (is_a($menu, Accordion::class)) { |
| 100 | 99 | $menu->add(['View', 'Test']); |
| 101 | - } |
|
| 102 | - else { |
|
| 100 | + } else { |
|
| 103 | 101 | $menu->addItem($item['caption'], $item['link']?? ''); |
| 104 | 102 | } |
| 105 | 103 | |