Skip to content

Commit f979cd5

Browse files
committed
Exclude route from generate menu command
1 parent 2c4834c commit f979cd5

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

config/admin.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,16 @@
361361
*/
362362
'enable_menu_search' => true,
363363

364+
/*
365+
|--------------------------------------------------------------------------
366+
| Exclude route from generate menu command
367+
|--------------------------------------------------------------------------
368+
*/
369+
'menu_exclude' => [
370+
'_handle_selectable_',
371+
'_handle_renderable_',
372+
],
373+
364374
/*
365375
|--------------------------------------------------------------------------
366376
| Alert message that will displayed on top of the page.

src/Console/GenerateMenuCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public function handle()
5555
&& !Str::startsWith($uri, 'admin/auth/')
5656
&& !Str::endsWith($uri, '/create')
5757
&& !Str::contains($uri, '{')
58-
&& in_array('GET', $route->methods());
58+
&& in_array('GET', $route->methods())
59+
&& !in_array(substr($route->uri(), strlen('admin/')), config('admin.menu_exclude'));
5960
})
6061
->map(function (Route $route) {
6162
$uri = substr($route->uri(), strlen('admin/'));

0 commit comments

Comments
 (0)