Completed
Push — 2.0 ( 5f7d48 )
by Nicolas
02:24
created

DashboardServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php namespace Modules\Dashboard\Providers;
2
3
use Illuminate\Support\ServiceProvider;
4
use Modules\Dashboard\Entities\Widget;
5
use Modules\Dashboard\Repositories\Cache\CacheWidgetDecorator;
6
use Modules\Dashboard\Repositories\Eloquent\EloquentWidgetRepository;
7
use Modules\Workshop\Manager\StylistThemeManager;
8
9
class DashboardServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Indicates if loading of the provider is deferred.
13
     *
14
     * @var bool
15
     */
16
    protected $defer = false;
17
18
    /**
19
     * Register the service provider.
20
     *
21
     * @return void
22
     */
23
    public function register()
24
    {
25
        $this->app->bind(
26
            'Modules\Dashboard\Repositories\WidgetRepository',
27
            function () {
28
                $repository = new EloquentWidgetRepository(new Widget());
29
30
                if (! config('app.cache')) {
31
                    return $repository;
32
                }
33
34
                return new CacheWidgetDecorator($repository);
35
            }
36
        );
37
    }
38
39
    public function boot(StylistThemeManager $theme)
40
    {
41
        $this->publishes([
42
            __DIR__ . '/../Resources/views' => base_path('resources/views/asgard/dashboard'),
43
        ], 'views');
44
45
        $this->app['view']->prependNamespace(
46
            'dashboard',
47
            base_path('resources/views/asgard/dashboard')
48
        );
49
        $this->app['view']->prependNamespace(
50
            'dashboard',
51
            $theme->find(config('asgard.core.core.admin-theme'))->getPath() . '/views/modules/dashboard'
52
        );
53
    }
54
55
    /**
56
     * Get the services provided by the provider.
57
     *
58
     * @return array
59
     */
60
    public function provides()
61
    {
62
        return array();
63
    }
64
}
65