Completed
Push — master ( e924b7...6dfcf0 )
by Arjay
03:14
created

DataTablesServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 9.4285
1
<?php
2
3
namespace Yajra\DataTables;
4
5
use Illuminate\Support\ServiceProvider;
6
use Yajra\DataTables\Utilities\Config;
7
use Yajra\DataTables\Utilities\Request;
8
9
class DataTablesServiceProvider 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
     * Bootstrap the application events.
20
     *
21
     * @return void
22
     */
23
    public function boot()
24
    {
25
        $this->mergeConfigFrom(__DIR__ . '/config/datatables.php', 'datatables');
26
27
        $this->publishes([
28
            __DIR__ . '/config/datatables.php' => config_path('datatables.php'),
29
        ], 'datatables');
30
    }
31
32
    /**
33
     * Register the service provider.
34
     *
35
     * @return void
36
     */
37
    public function register()
38
    {
39
        $this->app->alias('datatables', DataTables::class);
40
        $this->app->singleton('datatables', function () {
41
            return new DataTables;
42
        });
43
44
        $this->app->singleton('datatables.request', function () {
45
            return new Request;
46
        });
47
48
        $this->app->singleton('datatables.config', Config::class);
49
    }
50
51
    /**
52
     * Get the services provided by the provider.
53
     *
54
     * @return string[]
55
     */
56
    public function provides()
57
    {
58
        return [
59
            'datatables',
60
            'datatables.config',
61
            'datatables.request',
62
        ];
63
    }
64
}
65