Completed
Push — master ( 86815f...7e02e6 )
by wen
02:47
created

NavigationServiceProvider::registerNavigation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
nc 1
cc 1
eloc 2
nop 1
1
<?php
2
3
namespace Sco\Admin\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use KodiComponents\Navigation\Contracts\NavigationInterface;
7
use KodiComponents\Navigation\Navigation;
8
use KodiComponents\Navigation\Contracts\BadgeInterface;
9
use KodiComponents\Navigation\Contracts\PageInterface;
10
use Sco\Admin\Navigation\Badge;
11
use Sco\Admin\Navigation\Page;
12
13
class NavigationServiceProvider extends ServiceProvider
14
{
15
    public function boot()
16
    {
17
        $this->app->call([$this, 'registerNavigation']);
18
    }
19
20
    public function register()
21
    {
22
        $this->app->singleton('admin.navigation', function () {
23
            return new Navigation();
24
        });
25
26
        $this->app->alias('admin.navigation', NavigationInterface::class);
27
28
        // overwrite Navigation Page Bind
29
        $this->app->bind(PageInterface::class, Page::class);
30
        $this->app->bind(BadgeInterface::class, Badge::class);
31
    }
32
33
    /**
34
     * @param NavigationInterface $navigation
35
     */
36
    public function registerNavigation(NavigationInterface $navigation)
37
    {
38
        require __DIR__ . '/../../src/navigation.php';
39
    }
40
}
41