Completed
Push — master ( 16ebaf...a3d07b )
by Arjay
14:09
created

WidgetServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Yajra\CMS\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Yajra\CMS\Widgets\Menu;
7
use Yajra\CMS\Widgets\Repository;
8
use Yajra\CMS\Widgets\Wysiwyg;
9
10
class WidgetServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap the application services.
14
     *
15
     * @return void
16
     */
17
    public function boot()
18
    {
19
        /** @var Repository $factory */
20
        $factory = $this->app['widgets'];
21
        $factory->register('menu', 'Menu Widget', Menu::class, [
22
            'widgets.menu.bootstrap' => 'Bootstrap Menu (widgets.menu.bootstrap)',
23
            'custom'                 => 'Custom Template',
24
        ])->register('wysiwyg', 'WYSIWYG', Wysiwyg::class, [
25
            'widgets.wysiwyg.default' => 'Default Bootstrap Panel (widgets.wysiwyg.default)',
26
            'widgets.wysiwyg.raw'     => 'Plain Body Contents (widgets.wysiwyg.raw)',
27
            'custom'                  => 'Custom Template',
28
        ]);
29
    }
30
31
    /**
32
     * Register the application services.
33
     *
34
     * @return void
35
     */
36
    public function register()
37
    {
38
        $this->app->singleton('widgets', function () {
39
            return new Repository;
40
        });
41
42
        $this->app->alias('widgets', Repository::class);
43
    }
44
45
    /**
46
     * @return array
47
     */
48
    public function provides()
49
    {
50
        return ['widgets'];
51
    }
52
}
53