1
|
|
|
<?php |
2
|
|
|
namespace JsLocalization; |
3
|
|
|
|
4
|
|
|
use App; |
5
|
|
|
use Artisan; |
6
|
|
|
use Config; |
7
|
|
|
use View; |
8
|
|
|
use Illuminate\Support\ServiceProvider; |
9
|
|
|
use Illuminate\Support\Facades\File; |
10
|
|
|
use JsLocalization\Console\ExportCommand; |
11
|
|
|
use JsLocalization\Console\RefreshCommand; |
12
|
|
|
|
13
|
|
|
class JsLocalizationServiceProvider extends ServiceProvider { |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Indicates if loading of the provider is deferred. |
17
|
|
|
* |
18
|
|
|
* @var bool |
19
|
|
|
*/ |
20
|
|
|
protected $defer = false; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Bootstrap the application events. |
24
|
|
|
* |
25
|
|
|
* @return void |
26
|
|
|
*/ |
27
|
25 |
|
public function boot() |
28
|
|
|
{ |
29
|
25 |
|
$this->publishes([ |
30
|
25 |
|
__DIR__.'/../config/config.php' => config_path('js-localization.php') |
31
|
25 |
|
]); |
32
|
|
|
|
33
|
25 |
|
$this->publishes([ |
34
|
25 |
|
__DIR__.'/../public/js/localization.min.js' => public_path('vendor/js-localization/js-localization.min.js'), |
35
|
25 |
|
], 'public'); |
36
|
|
|
|
37
|
25 |
|
$this->mergeConfigFrom( |
38
|
25 |
|
__DIR__.'/../config/config.php', 'js-localization' |
39
|
25 |
|
); |
40
|
|
|
|
41
|
25 |
|
$this->loadViewsFrom(__DIR__.'/../resources/views', 'js-localization'); |
42
|
|
|
|
43
|
25 |
|
$this->registerRefreshCommand(); |
44
|
25 |
|
$this->registerExportCommand(); |
45
|
25 |
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Register the service provider. |
49
|
|
|
* |
50
|
|
|
* @return void |
51
|
|
|
*/ |
52
|
25 |
|
public function register() |
53
|
|
|
{ |
54
|
25 |
|
require __DIR__.'/bindings.php'; |
55
|
25 |
|
require __DIR__.'/Http/routes.php'; |
56
|
25 |
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Get the services provided by the provider. |
60
|
|
|
* |
61
|
|
|
* @return array |
62
|
|
|
*/ |
63
|
25 |
|
public function provides() |
64
|
25 |
|
{ |
65
|
1 |
|
return ['js-localization']; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Register js-localization.refresh |
70
|
|
|
*/ |
71
|
25 |
|
private function registerRefreshCommand() |
72
|
|
|
{ |
73
|
25 |
|
$this->app->singleton('js-localization.refresh', function() |
74
|
|
|
{ |
75
|
3 |
|
return new RefreshCommand; |
76
|
25 |
|
}); |
77
|
|
|
|
78
|
25 |
|
$this->commands('js-localization.refresh'); |
79
|
25 |
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Register js-localization.export |
83
|
|
|
*/ |
84
|
25 |
|
private function registerExportCommand() |
85
|
|
|
{ |
86
|
25 |
|
$this->app->singleton('js-localization.export', function() |
87
|
|
|
{ |
88
|
3 |
|
return new ExportCommand; |
89
|
25 |
|
}); |
90
|
|
|
|
91
|
25 |
|
$this->commands('js-localization.export'); |
92
|
25 |
|
} |
93
|
|
|
|
94
|
|
|
} |
95
|
|
|
|