1 | <?php |
||
17 | class NwLaravelServiceProvider extends ServiceProvider |
||
18 | { |
||
19 | /** |
||
20 | * Indicates if loading of the provider is deferred. |
||
21 | * |
||
22 | * @var bool |
||
23 | */ |
||
24 | protected $defer = false; |
||
25 | |||
26 | /** |
||
27 | * Bootstrap any necessary services. |
||
28 | * |
||
29 | * @return void |
||
30 | */ |
||
31 | public function boot() |
||
32 | { |
||
33 | $this->bootPublishConfig(); |
||
34 | |||
35 | $this->bootValidator(); |
||
36 | $this->bootTranslatorCarbon(); |
||
37 | $this->bootActivityLog(); |
||
38 | $this->bootOlxDriver(); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Register the service provider. |
||
43 | * |
||
44 | * @return void |
||
45 | */ |
||
46 | public function register() |
||
47 | { |
||
48 | $this->registerActivityLog(); |
||
49 | $this->app->register(EventCleanCacheRepository::class); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Boot Publish Config |
||
54 | * |
||
55 | * @return void |
||
56 | */ |
||
57 | public function bootPublishConfig() |
||
70 | |||
71 | /** |
||
72 | * Boot Translator Carbon |
||
73 | * |
||
74 | * @return void |
||
75 | */ |
||
76 | protected function bootTranslatorCarbon() |
||
77 | { |
||
78 | $locale = $this->app['config']->get('app.locale'); |
||
79 | $path = __DIR__.'/../../resources/lang/'.$locale.'/carbon.php'; |
||
80 | |||
81 | if (file_exists($path)) { |
||
82 | $translator = new Translator($locale); |
||
83 | $translator->addLoader('array', new ArrayLoader()); |
||
84 | $translator->addResource('array', require $path, $locale); |
||
85 | Carbon::setTranslator($translator); |
||
86 | } |
||
87 | } |
||
88 | |||
89 | /** |
||
90 | * Boot Validator |
||
91 | * |
||
92 | * @return void |
||
93 | */ |
||
94 | protected function bootValidator() |
||
95 | { |
||
96 | $this->app['validator']->resolver(function ($translator, $data, $rules, $messages, $customAttributes) { |
||
97 | return new ValidatorResolver($translator, $data, $rules, $messages, $customAttributes); |
||
98 | }); |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * Boot Activity Log |
||
103 | * |
||
104 | * @return void |
||
105 | */ |
||
106 | protected function bootActivityLog() |
||
117 | |||
118 | /** |
||
119 | * Registero Activity Log |
||
120 | * |
||
121 | * @return void |
||
122 | */ |
||
123 | protected function registerActivityLog() |
||
137 | |||
138 | /** |
||
139 | * Boot OlxDriver |
||
140 | * |
||
141 | * @return void |
||
142 | */ |
||
143 | protected function bootOlxDriver() |
||
157 | } |
||
158 |