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

ServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 94.74%

Importance

Changes 0
Metric Value
wmc 4
eloc 14
c 0
b 0
f 0
dl 0
loc 40
ccs 18
cts 19
cp 0.9474
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A routes() 0 13 2
A register() 0 2 1
A boot() 0 8 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