ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace NovaListCard;
4
5
use Illuminate\Support\Facades\Route;
6
use Laravel\Nova\Events\ServingNova;
7
use Laravel\Nova\Nova;
8
9
class ServiceProvider extends \Illuminate\Support\ServiceProvider
10
{
11
    /**
12
     * Bootstrap any application services.
13
     */
14 14
    public function boot()
15
    {
16 14
        $this->app->booted(function () {
17 14
            $this->routes();
18 14
        });
19
20 14
        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

20
        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...
21 6
            Nova::script('list-card', __DIR__ . '/../dist/js/card.js');
22 14
        });
23
    }
24
25
    /**
26
     * Register the card's routes.
27
     */
28 14
    protected function routes()
29
    {
30 14
        if ($this->app->routesAreCached()) {
31
            return;
32
        }
33
34 14
        Route::middleware(['nova'])
35 14
            ->prefix('nova-vendor/nova-list-card')
36 14
            ->group(function () {
37 14
                Route::get(
38 14
                    '/{key}',
39 14
                    \NovaListCard\Http\Controllers\ResourceController::class
40 14
                )->name('nova-list-card.data');
41 14
            });
42
    }
43
44
    /**
45
     * Register any application services.
46
     */
47 14
    public function register()
48
    {
49 14
    }
50
}
51