ServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 95%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 14
c 1
b 0
f 0
dl 0
loc 42
ccs 19
cts 20
cp 0.95
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 2 1
A routes() 0 17 2
A boot() 0 9 1
1
<?php
2
3
namespace NovaNavigaAdPreview;
4
5
use Illuminate\Support\Facades\Route;
6
use Laravel\Nova\Events\ServingNova;
7
use Laravel\Nova\Http\Middleware\Authenticate;
8
use Laravel\Nova\Nova;
9
use NovaNavigaAdPreview\Http\Middleware\Authorize;
10
11
class ServiceProvider extends \Illuminate\Support\ServiceProvider
12
{
13 2
    public function boot(): void
14
    {
15 2
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'nova-naviga-ad-preview');
16
17 2
        $this->app->booted(function () {
18 2
            $this->routes();
19 2
        });
20
21 2
        Nova::serving(function (ServingNova $event) {
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

21
        Nova::serving(function (/** @scrutinizer ignore-unused */ ServingNova $event) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
            //
23 2
        });
24
    }
25
26
    /**
27
     * Register any application services.
28
     *
29
     * @return void
30
     */
31 2
    public function register()
32
    {
33
        //
34 2
    }
35
36 2
    protected function routes(): void
37
    {
38 2
        if ($this->app->routesAreCached()) {
39
            return;
40
        }
41
42
        // Load admin dashboard routes
43 2
        Nova::router(
44 2
            ['nova', Authenticate::class, Authorize::class],
45 2
            'nova-naviga-ad-preview'
46 2
        )
47 2
            ->group(__DIR__.'/../routes/inertia.php');
48
49
        // Load api routes
50 2
        Route::middleware(['nova', Authorize::class])
51 2
            ->prefix('nova-vendor/nova-naviga-ad-preview')
52 2
            ->group(__DIR__.'/../routes/api.php');
53
    }
54
}
55