|
1
|
|
|
<?php namespace crocodicstudio\crudbooster; |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Support\Facades\Artisan; |
|
4
|
|
|
use Illuminate\Support\ServiceProvider; |
|
5
|
|
|
use crocodicstudio\crudbooster\commands\CrudboosterInstallationCommand; |
|
6
|
|
|
use crocodicstudio\crudbooster\commands\CrudboosterUpdateCommand; |
|
7
|
|
|
use Illuminate\Foundation\AliasLoader; |
|
8
|
|
|
use App; |
|
9
|
|
|
|
|
10
|
|
|
class CRUDBoosterServiceProvider extends ServiceProvider |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* Bootstrap the application services. |
|
14
|
|
|
* |
|
15
|
|
|
* @return void |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
public function boot() |
|
19
|
|
|
{ |
|
20
|
|
|
|
|
21
|
|
|
$this->loadViewsFrom(__DIR__.'/views', 'crudbooster'); |
|
22
|
|
|
$this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')],'cb_config'); |
|
23
|
|
|
$this->publishes([__DIR__.'/localization' => resource_path('lang')], 'cb_localization'); |
|
24
|
|
|
$this->publishes([__DIR__.'/database' => base_path('database')],'cb_migration'); |
|
25
|
|
|
|
|
26
|
|
|
$this->publishes([ |
|
27
|
|
|
__DIR__.'/userfiles/views/vendor/crudbooster/type_components/readme.txt' => resource_path('views/vendor/crudbooster/type_components/readme.txt'), |
|
28
|
|
|
],'cb_type_components'); |
|
29
|
|
|
|
|
30
|
|
|
if(!file_exists(app_path('Http/Controllers/CBHook.php'))) { |
|
31
|
|
|
$this->publishes([__DIR__.'/userfiles/controllers/CBHook.php' => app_path('Http/Controllers/CBHook.php')],'CBHook'); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
if(!file_exists(app_path('Http/Controllers/AdminCmsUsersController.php'))) { |
|
35
|
|
|
$this->publishes([__DIR__.'/userfiles/controllers/AdminCmsUsersController.php' => app_path('Http/Controllers/AdminCmsUsersController.php')],'cb_user_controller'); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
$this->publishes([ |
|
39
|
|
|
__DIR__.'/assets'=>public_path('vendor/crudbooster') |
|
40
|
|
|
],'cb_asset'); |
|
41
|
|
|
|
|
42
|
|
|
require __DIR__.'/validations/validation.php'; |
|
43
|
|
|
require __DIR__.'/routes.php'; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Register the application services. |
|
48
|
|
|
* |
|
49
|
|
|
* @return void |
|
50
|
|
|
*/ |
|
51
|
|
|
public function register() |
|
52
|
|
|
{ |
|
53
|
|
|
require __DIR__.'/helpers/Helper.php'; |
|
54
|
|
|
|
|
55
|
|
|
$this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php','crudbooster'); |
|
56
|
|
|
|
|
57
|
|
|
$this->app->singleton('crudbooster', function () |
|
58
|
|
|
{ |
|
59
|
|
|
return true; |
|
60
|
|
|
}); |
|
61
|
|
|
|
|
62
|
|
|
$this->commands([ |
|
63
|
|
|
commands\Mailqueues::class |
|
64
|
|
|
]); |
|
65
|
|
|
|
|
66
|
|
|
$this->registerCrudboosterCommand(); |
|
67
|
|
|
|
|
68
|
|
|
$this->commands('crudboosterinstall'); |
|
69
|
|
|
$this->commands('crudboosterupdate'); |
|
70
|
|
|
$this->commands(['\crocodicstudio\crudbooster\commands\CrudboosterVersionCommand']); |
|
71
|
|
|
|
|
72
|
|
|
$this->app->register('Barryvdh\DomPDF\ServiceProvider'); |
|
73
|
|
|
$this->app->register('Maatwebsite\Excel\ExcelServiceProvider'); |
|
74
|
|
|
$this->app->register('Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider'); |
|
75
|
|
|
$this->app->register('Intervention\Image\ImageServiceProvider'); |
|
76
|
|
|
|
|
77
|
|
|
$loader = AliasLoader::getInstance(); |
|
78
|
|
|
$loader->alias('PDF', 'Barryvdh\DomPDF\Facade'); |
|
79
|
|
|
$loader->alias('Excel', 'Maatwebsite\Excel\Facades\Excel'); |
|
80
|
|
|
$loader->alias('Image', 'Intervention\Image\Facades\Image'); |
|
81
|
|
|
$loader->alias('CRUDBooster', 'crocodicstudio\crudbooster\helpers\CRUDBooster'); |
|
82
|
|
|
$loader->alias('CB', 'crocodicstudio\crudbooster\helpers\CB'); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
private function registerCrudboosterCommand() |
|
86
|
|
|
{ |
|
87
|
|
|
$this->app->singleton('crudboosterinstall',function() { |
|
88
|
|
|
return new CrudboosterInstallationCommand; |
|
89
|
|
|
}); |
|
90
|
|
|
|
|
91
|
|
|
$this->app->singleton('crudboosterupdate',function() { |
|
92
|
|
|
return new CrudboosterUpdateCommand; |
|
93
|
|
|
}); |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|