Completed
Push — master ( 875706...2db17d )
by Arjay
06:52
created

HtmlServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Yajra\DataTables;
4
5
use Collective\Html\HtmlServiceProvider as CollectiveHtml;
6
use Illuminate\Support\ServiceProvider;
7
8
class HtmlServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Indicates if loading of the provider is deferred.
12
     *
13
     * @var bool
14
     */
15
    protected $defer = false;
16
17
    /**
18
     * Bootstrap the application events.
19
     *
20
     * @return void
21
     */
22
    public function boot()
23
    {
24
        $this->loadViewsFrom(__DIR__ . '/resources/views', 'datatables');
25
        $this->mergeConfigFrom(__DIR__.'/resources/config/config.php', 'datatables-html');
26
27
        $this->publishAssets();
28
    }
29
30
    /**
31
     * Publish datatables assets.
32
     */
33
    protected function publishAssets()
34
    {
35
        $this->publishes([
36
            __DIR__ . '/resources/views' => base_path('/resources/views/vendor/datatables'),
37
            __DIR__ . '/resources/config/config.php' => config_path('datatables-html.php'),
38
        ], 'datatables-html');
39
    }
40
41
    /**
42
     * Register the service provider.
43
     *
44
     * @return void
45
     */
46
    public function register()
47
    {
48
        $this->app->register(CollectiveHtml::class);
49
50
        $this->app->bind('datatables.html', function () {
51
            return $this->app->make(Html\Builder::class);
52
        });
53
    }
54
55
    /**
56
     * Get the services provided by the provider.
57
     *
58
     * @return string[]
59
     */
60
    public function provides()
61
    {
62
        return ['datatables.html'];
63
    }
64
}
65