1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Mcamara\LaravelLocalization; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
|
7
|
|
|
class LaravelLocalizationServiceProvider extends ServiceProvider |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* Bootstrap the application events. |
11
|
|
|
* |
12
|
|
|
* @return void |
13
|
|
|
*/ |
14
|
|
|
public function boot() |
15
|
|
|
{ |
16
|
|
|
$this->publishes([ |
17
|
|
|
__DIR__.'/../../config/config.php' => config_path('laravellocalization.php'), |
18
|
|
|
], 'config'); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Get the services provided by the provider. |
23
|
|
|
* |
24
|
|
|
* @return array |
25
|
|
|
*/ |
26
|
|
|
public function provides() |
27
|
|
|
{ |
28
|
|
|
return ['modules.handler', 'modules']; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Register the service provider. |
33
|
|
|
* |
34
|
|
|
* @return void |
35
|
|
|
*/ |
36
|
|
|
public function register() |
37
|
|
|
{ |
38
|
|
|
$packageConfigFile = __DIR__.'/../../config/config.php'; |
39
|
|
|
|
40
|
|
|
$this->mergeConfigFrom( |
41
|
|
|
$packageConfigFile, 'laravellocalization' |
42
|
|
|
); |
43
|
|
|
|
44
|
|
|
$this->registerBindings(); |
45
|
|
|
|
46
|
|
|
$this->registerCommands(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Registers app bindings and aliases. |
51
|
|
|
*/ |
52
|
|
|
protected function registerBindings() |
53
|
|
|
{ |
54
|
|
|
$this->app->singleton(LaravelLocalization::class, function () { |
55
|
|
|
return new LaravelLocalization(); |
56
|
|
|
}); |
57
|
|
|
|
58
|
|
|
$this->app->alias(LaravelLocalization::class, 'laravellocalization'); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Registers route caching commands. |
63
|
|
|
*/ |
64
|
|
|
protected function registerCommands() |
65
|
|
|
{ |
66
|
|
|
$this->app->singleton('laravellocalizationroutecache.cache', Commands\RouteTranslationsCacheCommand::class); |
67
|
|
|
$this->app->singleton('laravellocalizationroutecache.clear', Commands\RouteTranslationsClearCommand::class); |
68
|
|
|
$this->app->singleton('laravellocalizationroutecache.list', Commands\RouteTranslationsListCommand::class); |
69
|
|
|
|
70
|
|
|
$this->commands([ |
71
|
|
|
'laravellocalizationroutecache.cache', |
72
|
|
|
'laravellocalizationroutecache.clear', |
73
|
|
|
'laravellocalizationroutecache.list', |
74
|
|
|
]); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|