Passed
Push — main ( 36e409...b1e3f6 )
by Yaroslav
02:51
created

ServiceProvider::routes()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2.004

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 13
ccs 9
cts 10
cp 0.9
rs 9.9666
cc 2
nc 2
nop 0
crap 2.004
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