AdminSectionsServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 3

2 Methods

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