AdminSectionsServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
namespace App\Providers;
4
5
use SleepingOwl\Admin\Contracts\Widgets\WidgetsRegistryInterface;
6
use SleepingOwl\Admin\Providers\AdminSectionsServiceProvider as ServiceProvider;
7
8
class AdminSectionsServiceProvider extends ServiceProvider
9
{
10
    protected $sections = [
11
    \App\User::class              => 'App\Admin\Sections\Users',
12
    \App\Role::class              => 'App\Admin\Sections\Roles',
13
    \App\Models\Script::class     => 'App\Admin\Sections\Scripts',
14
    \App\Setting::class           => 'App\Admin\Sections\Settings',
15
16
  ];
17
18
    protected $widgets = [
19
    \App\Admin\Widgets\NavigationUserBlock::class,
20
  ];
21
22
    public function boot(\SleepingOwl\Admin\Admin $admin)
23
    {
24
        $this->loadViewsFrom(base_path('resources/views/admin'), 'admin');
25
        $this->registerPolicies('App\\Admin\\Policies\\');
26
27
        parent::boot($admin);
28
29
        $this->app->call([$this, 'registerViews']);
30
    }
31
32
    public function registerViews(WidgetsRegistryInterface $widgetsRegistry)
33
    {
34
        foreach ($this->widgets as $widget) {
35
            $widgetsRegistry->registerWidget($widget);
36
        }
37
    }
38
}
39