KyleMassacre /
laravel-menus
| 1 | <?php |
||
| 2 | |||
| 3 | use Illuminate\Support\Facades\Route; |
||
| 4 | use KyleMassacre\Menus\Facades\Menu; |
||
| 5 | use KyleMassacre\Menus\MenuBuilder; |
||
| 6 | use App\Http\Presenters\MainMenuPresenter; |
||
|
0 ignored issues
–
show
|
|||
| 7 | |||
| 8 | // Define routes first to ensure they exist before menu creation |
||
| 9 | // These should typically be in your routes file, but for demonstration: |
||
| 10 | if (!Route::has('login')) { |
||
| 11 | Route::get('/login', function () { |
||
| 12 | return view('auth.login'); |
||
| 13 | })->name('login'); |
||
| 14 | } |
||
| 15 | |||
| 16 | // Create menu after routes are defined |
||
| 17 | Menu::create('main-guest', function (MenuBuilder $menu) { |
||
| 18 | $menu->setPresenter(MainMenuPresenter::class); |
||
| 19 | $menu->add([ |
||
| 20 | 'route' => 'login', |
||
| 21 | 'title' => 'Login', |
||
| 22 | 'icon' => 'fa fa-sign-in fa-fw me-2', |
||
| 23 | ]); |
||
| 24 | }); |
||
| 25 | |||
| 26 | // You can also create additional menus |
||
| 27 | Menu::create('main-auth', function (MenuBuilder $menu) { |
||
| 28 | $menu->setPresenter(MainMenuPresenter::class); |
||
| 29 | $menu->add([ |
||
| 30 | 'url' => '/dashboard', |
||
| 31 | 'title' => 'Dashboard', |
||
| 32 | 'icon' => 'fa fa-dashboard fa-fw me-2', |
||
| 33 | ]); |
||
| 34 | |||
| 35 | $menu->add([ |
||
| 36 | 'route' => ['profile.show', []], |
||
| 37 | 'title' => 'Profile', |
||
| 38 | 'icon' => 'fa fa-user fa-fw me-2', |
||
| 39 | ]); |
||
| 40 | }); |
||
| 41 | |||
| 42 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths