Issues (39)

src/ToolServiceProvider.php (2 issues)

1
<?php
2
3
namespace AlexBowers\MultipleDashboard;
4
5
use Laravel\Nova\Nova;
6
use Laravel\Nova\Events\ServingNova;
7
use Illuminate\Support\Facades\Route;
8
use Illuminate\Support\ServiceProvider;
9
use AlexBowers\MultipleDashboard\Http\Middleware\Authorize;
10
use AlexBowers\MultipleDashboard\Console\Commands\CreateDashboard;
11
12
class ToolServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Bootstrap any application services.
16
     *
17
     * @return void
18
     */
19
    public function boot()
20
    {
21
        $this->loadViewsFrom(__DIR__ . '/../resources/views/nova-overrides', 'nova');
22
23
        Nova::serving(function (ServingNova $event) {
0 ignored issues
show
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

23
        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...
24
            DashboardNova::dashboardsIn(app_path('Nova/Dashboards'));
25
            Nova::script('nova-multiple-dashboard', __DIR__ . '/../dist/js/MultipleDashboard.js');
26
        });
27
28
        $this->app->booted(function () {
29
            $this->routes();
30
31
            Nova::serving(function (ServingNova $event) {
0 ignored issues
show
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

31
            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...
32
                DashboardNova::copyDefaultDashboardCards();
33
                DashboardNova::cardsInDashboards();
34
            });
35
        });
36
37
        if ($this->app->runningInConsole()) {
38
            $this->commands([
39
                CreateDashboard::class,
40
            ]);
41
        }
42
    }
43
44
    /**
45
     * Register the tool's routes.
46
     *
47
     * @return void
48
     */
49
    protected function routes()
50
    {
51
        if ($this->app->routesAreCached()) {
52
            return;
53
        }
54
55
        Route::middleware('nova')
56
                ->prefix('nova-vendor/AlexBowers/nova-multiple-dashboard')
57
                ->group(__DIR__.'/../routes/api.php');
58
    }
59
}
60