Completed
Push — master ( b3476e...5a1910 )
by Arjay
08:06
created

HtmlServiceProvider::provides()   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
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Yajra\DataTables;
4
5
use Illuminate\Support\ServiceProvider;
6
use Collective\Html\HtmlServiceProvider as CollectiveHtml;
7
8
class HtmlServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application events.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        $this->loadViewsFrom(__DIR__ . '/resources/views', 'datatables');
18
19
        if ($this->app->runningInConsole()) {
20
            $this->publishAssets();
21
        }
22
    }
23
24
    /**
25
     * Publish datatables assets.
26
     */
27
    protected function publishAssets()
28
    {
29
        $this->publishes([
30
            __DIR__ . '/resources/views'             => base_path('/resources/views/vendor/datatables'),
31
            __DIR__ . '/resources/config/config.php' => config_path('datatables-html.php'),
32
        ], 'datatables-html');
33
    }
34
35
    /**
36
     * Register the service provider.
37
     *
38
     * @return void
39
     */
40
    public function register()
41
    {
42
        $this->mergeConfigFrom(__DIR__ . '/resources/config/config.php', 'datatables-html');
43
44
        $this->app->register(CollectiveHtml::class);
45
46
        $this->app->bind('datatables.html', function () {
47
            return $this->app->make(Html\Builder::class);
48
        });
49
    }
50
}
51