1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Yajra\DataTables; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
use Maatwebsite\Excel\ExcelServiceProvider; |
7
|
|
|
use Yajra\DataTables\Generators\DataTablesMakeCommand; |
8
|
|
|
use Yajra\DataTables\Generators\DataTablesScopeCommand; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class DatatablesServiceProvider. |
12
|
|
|
* |
13
|
|
|
* @package Yajra\Datatables |
14
|
|
|
* @author Arjay Angeles <[email protected]> |
15
|
|
|
*/ |
16
|
|
|
class ButtonsServiceProvider extends ServiceProvider |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* Indicates if loading of the provider is deferred. |
20
|
|
|
* |
21
|
|
|
* @var bool |
22
|
|
|
*/ |
23
|
|
|
protected $defer = false; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Bootstrap the application events. |
27
|
|
|
* |
28
|
|
|
* @return void |
29
|
|
|
*/ |
30
|
|
|
public function boot() |
31
|
|
|
{ |
32
|
|
|
$this->loadViewsFrom(__DIR__ . '/resources/views', 'datatables'); |
33
|
|
|
|
34
|
|
|
$this->publishAssets(); |
35
|
|
|
|
36
|
|
|
$this->registerCommands(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Publish datatables assets. |
41
|
|
|
*/ |
42
|
|
|
protected function publishAssets() |
43
|
|
|
{ |
44
|
|
|
$this->mergeConfigFrom(__DIR__ . '/config/config.php', 'datatables-buttons'); |
45
|
|
|
$this->publishes([ |
46
|
|
|
__DIR__ . '/config/config.php' => config_path('datatables-buttons.php'), |
47
|
|
|
], 'datatables-buttons'); |
48
|
|
|
|
49
|
|
|
$this->publishes([ |
50
|
|
|
__DIR__ . '/resources/assets/buttons.server-side.js' => public_path('vendor/datatables/buttons.server-side.js'), |
51
|
|
|
], 'datatables-buttons'); |
52
|
|
|
|
53
|
|
|
$this->publishes([ |
54
|
|
|
__DIR__ . '/resources/views' => base_path('/resources/views/vendor/datatables'), |
55
|
|
|
], 'datatables-buttons'); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Register datatables commands. |
60
|
|
|
*/ |
61
|
|
|
protected function registerCommands() |
62
|
|
|
{ |
63
|
|
|
$this->commands(DataTablesMakeCommand::class); |
64
|
|
|
$this->commands(DataTablesScopeCommand::class); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Register the service provider. |
69
|
|
|
* |
70
|
|
|
* @return void |
71
|
|
|
*/ |
72
|
|
|
public function register() |
73
|
|
|
{ |
74
|
|
|
$this->app->register(HtmlServiceProvider::class); |
75
|
|
|
$this->app->register(ExcelServiceProvider::class); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|