@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function getOpenTagWrapper(): ?string |
14 | 14 | { |
15 | - return PHP_EOL . '<ul class="sidebar-menu tree" data-widget="tree">' . PHP_EOL; |
|
15 | + return PHP_EOL.'<ul class="sidebar-menu tree" data-widget="tree">'.PHP_EOL; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function getCloseTagWrapper(): ?string |
22 | 22 | { |
23 | - return PHP_EOL . '</ul>' . PHP_EOL; |
|
23 | + return PHP_EOL.'</ul>'.PHP_EOL; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getMenuWithoutDropdownWrapper(MenuItemContract $item): ?string |
30 | 30 | { |
31 | - return '<li' . $this->getActiveState($item) . '><a href="' . $item->getUrl() . '" ' . $item->getAttributes() . '>' . $item->getIcon() . ' <span>' . $item->title . '</span></a></li>' . PHP_EOL; |
|
31 | + return '<li'.$this->getActiveState($item).'><a href="'.$item->getUrl().'" '.$item->getAttributes().'>'.$item->getIcon().' <span>'.$item->title.'</span></a></li>'.PHP_EOL; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function getHeaderWrapper(MenuItemContract $item): ?string |
67 | 67 | { |
68 | - return '<li class="header">' . $item->title . '</li>'; |
|
68 | + return '<li class="header">'.$item->title.'</li>'; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getMenuWithDropDownWrapper(MenuItemContract $item): ?string |
75 | 75 | { |
76 | - return '<li class="treeview' . $this->getActiveStateOnChild($item, ' active') . '"> |
|
76 | + return '<li class="treeview'.$this->getActiveStateOnChild($item, ' active').'"> |
|
77 | 77 | <a href="#"> |
78 | - ' . $item->getIcon() . ' <span>' . $item->title . '</span> |
|
78 | + ' . $item->getIcon().' <span>'.$item->title.'</span> |
|
79 | 79 | <span class="pull-right-container"> |
80 | 80 | <i class="fa fa-angle-left pull-right"></i> |
81 | 81 | </span> |
82 | 82 | </a> |
83 | 83 | <ul class="treeview-menu"> |
84 | - ' . $this->getChildMenuItems($item) . ' |
|
84 | + ' . $this->getChildMenuItems($item).' |
|
85 | 85 | </ul> |
86 | 86 | </li>' |
87 | 87 | . PHP_EOL; |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function getMultiLevelDropdownWrapper(MenuItemContract $item): string |
98 | 98 | { |
99 | - return '<li class="treeview' . $this->getActiveStateOnChild($item, ' active') . '"> |
|
99 | + return '<li class="treeview'.$this->getActiveStateOnChild($item, ' active').'"> |
|
100 | 100 | <a href="#"> |
101 | - ' . $item->getIcon() . ' <span>' . $item->title . '</span> |
|
101 | + ' . $item->getIcon().' <span>'.$item->title.'</span> |
|
102 | 102 | <span class="pull-right-container"> |
103 | 103 | <i class="fa fa-angle-left pull-right"></i> |
104 | 104 | </span> |
105 | 105 | </a> |
106 | 106 | <ul class="treeview-menu"> |
107 | - ' . $this->getChildMenuItems($item) . ' |
|
107 | + ' . $this->getChildMenuItems($item).' |
|
108 | 108 | </ul> |
109 | 109 | </li>' |
110 | 110 | . PHP_EOL; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | public function it_can_create_a_dropdown_menu_item() |
107 | 107 | { |
108 | 108 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
109 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
109 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
110 | 110 | $sub->url('settings/account', 'Account'); |
111 | 111 | $sub->url('settings/password', 'Password'); |
112 | 112 | }); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function it_can_make_a_simple_route_menu_item() |
119 | 119 | { |
120 | 120 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
121 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
121 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
122 | 122 | $sub->route('settings.account', 'Account', ['user_id' => 1]); |
123 | 123 | }); |
124 | 124 | $children = $menuItem->getChildren()[0]->getChilds(); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function it_can_make_a_route_menu_item() |
134 | 134 | { |
135 | 135 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
136 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
136 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
137 | 137 | $sub->route('settings.account', 'Account', ['user_id' => 1], 1, ['my-attr' => 'value']); |
138 | 138 | }); |
139 | 139 | $children = $menuItem->getChildren()[0]->getChilds(); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | public function it_can_make_a_simple_url_menu_item() |
151 | 151 | { |
152 | 152 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
153 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
153 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
154 | 154 | $sub->url('settings/account', 'Account'); |
155 | 155 | }); |
156 | 156 | $children = $menuItem->getChildren()[0]->getChilds(); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function it_can_make_a_url_menu_item() |
166 | 166 | { |
167 | 167 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
168 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
168 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
169 | 169 | $sub->url('settings/account', 'Account', 1, ['my-attr' => 'value']); |
170 | 170 | }); |
171 | 171 | $children = $menuItem->getChildren()[0]->getChilds(); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | public function it_can_add_a_menu_item_divider() |
183 | 183 | { |
184 | 184 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
185 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
185 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
186 | 186 | $sub->url('settings/account', 'Account'); |
187 | 187 | $sub->divider(); |
188 | 188 | }); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | public function it_can_add_a_header_menu_item() |
200 | 200 | { |
201 | 201 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
202 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
202 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
203 | 203 | $sub->header('User Stuff'); |
204 | 204 | $sub->url('settings/account', 'Account'); |
205 | 205 | }); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | $this->app['router']->get('settings/account', ['as' => 'settings.account']); |
228 | 228 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
229 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
229 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
230 | 230 | $sub->route('settings.account', 'Account'); |
231 | 231 | }); |
232 | 232 | $children = $menuItem->getChildren()[0]->getChilds(); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | public function it_can_check_for_a_submenu() |
288 | 288 | { |
289 | 289 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
290 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
290 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
291 | 291 | $sub->header('User Stuff'); |
292 | 292 | $sub->url('settings/account', 'Account'); |
293 | 293 | }); |
@@ -135,7 +135,7 @@ |
||
135 | 135 | |
136 | 136 | abstract public function getBadge(): string; |
137 | 137 | |
138 | - abstract public function getIcon(null|string $default): ?string; |
|
138 | + abstract public function getIcon(null | string $default): ?string; |
|
139 | 139 | |
140 | 140 | abstract public function getProperties(): array; |
141 | 141 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $this->registerSpatieHtmlPackage(); |
42 | 42 | |
43 | - $this->app->singleton('menus', function ($app) { |
|
43 | + $this->app->singleton('menus', function($app) { |
|
44 | 44 | return new Menu($app['view'], $app['config']); |
45 | 45 | }); |
46 | 46 | } |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function registerNamespaces() |
77 | 77 | { |
78 | - $configPath = __DIR__ . '/../config/config.php'; |
|
79 | - $viewsPath = __DIR__ . '/../views'; |
|
78 | + $configPath = __DIR__.'/../config/config.php'; |
|
79 | + $viewsPath = __DIR__.'/../views'; |
|
80 | 80 | $this->mergeConfigFrom($configPath, 'menus'); |
81 | 81 | $this->loadViewsFrom($viewsPath, 'menus'); |
82 | 82 |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | // Define routes first to ensure they exist before menu creation |
9 | 9 | // These should typically be in your routes file, but for demonstration: |
10 | 10 | if (!Route::has('login')) { |
11 | - Route::get('/login', function () { |
|
11 | + Route::get('/login', function() { |
|
12 | 12 | return view('auth.login'); |
13 | 13 | })->name('login'); |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Create menu after routes are defined |
17 | -Menu::create('main-guest', function (MenuBuilder $menu) { |
|
17 | +Menu::create('main-guest', function(MenuBuilder $menu) { |
|
18 | 18 | $menu->setPresenter(MainMenuPresenter::class); |
19 | 19 | $menu->add([ |
20 | 20 | 'route' => 'login', |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | }); |
25 | 25 | |
26 | 26 | // You can also create additional menus |
27 | -Menu::create('main-auth', function (MenuBuilder $menu) { |
|
27 | +Menu::create('main-auth', function(MenuBuilder $menu) { |
|
28 | 28 | $menu->setPresenter(MainMenuPresenter::class); |
29 | 29 | $menu->add([ |
30 | 30 | 'url' => '/dashboard', |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function findBy($key, $value) |
129 | 129 | { |
130 | - return collect($this->items)->filter(function ($item) use ($key, $value) { |
|
130 | + return collect($this->items)->filter(function($item) use ($key, $value) { |
|
131 | 131 | return $item->{$key} == $value; |
132 | 132 | })->first(); |
133 | 133 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | preg_match_all('/{[\s]*?([^\s]+)[\s]*?}/i', $key, $matches, PREG_SET_ORDER); |
297 | 297 | foreach ($matches as $match) { |
298 | 298 | if (array_key_exists($match[1], $this->bindings)) { |
299 | - $key = preg_replace('/' . $match[0] . '/', $this->bindings[$match[1]], $key, 1); |
|
299 | + $key = preg_replace('/'.$match[0].'/', $this->bindings[$match[1]], $key, 1); |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | protected function resolveItems(array &$items) |
314 | 314 | { |
315 | - $resolver = function ($property) { |
|
315 | + $resolver = function($property) { |
|
316 | 316 | return $this->resolve($property) ?: $property; |
317 | 317 | }; |
318 | 318 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | */ |
412 | 412 | protected function formatUrl($url) |
413 | 413 | { |
414 | - $uri = !is_null($this->prefixUrl) ? $this->prefixUrl . $url : $url; |
|
414 | + $uri = !is_null($this->prefixUrl) ? $this->prefixUrl.$url : $url; |
|
415 | 415 | |
416 | 416 | return $uri == '/' ? '/' : ltrim(rtrim($uri, '/'), '/'); |
417 | 417 | } |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | public function getOrderedItems() |
629 | 629 | { |
630 | 630 | if (config('menus.ordering') || $this->ordering) { |
631 | - return $this->toCollection()->sortBy(function ($item) { |
|
631 | + return $this->toCollection()->sortBy(function($item) { |
|
632 | 632 | return $item->order; |
633 | 633 | })->all(); |
634 | 634 | } |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | $presenter = $this->getPresenter(); |
647 | 647 | $menu = $presenter->getOpenTagWrapper(); |
648 | 648 | |
649 | - $items = array_filter($this->getOrderedItems(), function ($item) { |
|
649 | + $items = array_filter($this->getOrderedItems(), function($item) { |
|
650 | 650 | return !$item->hidden(); |
651 | 651 | }); |
652 | 652 |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | if ($this->hasBadge()) { |
277 | 277 | extract($this->badge); |
278 | 278 | |
279 | - return '<span class="' . $type . '">' . $text . '</span>'; |
|
279 | + return '<span class="'.$type.'">'.$text.'</span>'; |
|
280 | 280 | } |
281 | 281 | return ''; |
282 | 282 | } |
@@ -291,13 +291,13 @@ discard block |
||
291 | 291 | public function getIcon(string $default = null): ?string |
292 | 292 | { |
293 | 293 | if ($this->icon !== null && $this->icon !== '') { |
294 | - return '<i class="' . $this->icon . '"></i>'; |
|
294 | + return '<i class="'.$this->icon.'"></i>'; |
|
295 | 295 | } |
296 | 296 | if ($default === null) { |
297 | 297 | return $default; |
298 | 298 | } |
299 | 299 | |
300 | - return '<i class="' . $default . '"></i>'; |
|
300 | + return '<i class="'.$default.'"></i>'; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -322,17 +322,17 @@ discard block |
||
322 | 322 | Arr::forget($attributes, ['active', 'icon']); |
323 | 323 | |
324 | 324 | $attributeString = collect($attributes) |
325 | - ->map(function ($value, $key) { |
|
325 | + ->map(function($value, $key) { |
|
326 | 326 | if (is_bool($value)) { |
327 | 327 | return $value ? $key : ''; |
328 | 328 | } |
329 | 329 | |
330 | - return $key . '="' . e($value) . '"'; |
|
330 | + return $key.'="'.e($value).'"'; |
|
331 | 331 | }) |
332 | 332 | ->filter() |
333 | 333 | ->implode(' '); |
334 | 334 | |
335 | - return $attributeString ? ' ' . $attributeString : ''; |
|
335 | + return $attributeString ? ' '.$attributeString : ''; |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $inactive = $this->getInactiveAttribute(); |
445 | 445 | |
446 | 446 | if ($inactive === '1' || $inactive === '0') { |
447 | - return (bool)$inactive; |
|
447 | + return (bool) $inactive; |
|
448 | 448 | } |
449 | 449 | if (is_bool($inactive)) { |
450 | 450 | return $inactive; |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | $active = $this->getActiveAttribute(); |
492 | 492 | |
493 | 493 | if ($active === '1' || $active === '0') { |
494 | - return (bool)$active; |
|
494 | + return (bool) $active; |
|
495 | 495 | } |
496 | 496 | if (is_bool($active)) { |
497 | 497 | return $active; |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | */ |
526 | 526 | protected function getActiveStateFromRoute(): bool |
527 | 527 | { |
528 | - return Request::is(str_replace(url('/') . '/', '', $this->getUrl())); |
|
528 | + return Request::is(str_replace(url('/').'/', '', $this->getUrl())); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |