1 | <?php |
||
2 | |||
3 | namespace Vahid\Respond; |
||
4 | |||
5 | use Illuminate\Support\ServiceProvider; |
||
6 | |||
7 | class RespondServiceProvider extends ServiceProvider |
||
8 | { |
||
9 | /** |
||
10 | * Perform post-registration booting of services. |
||
11 | * |
||
12 | * @return void |
||
13 | */ |
||
14 | public function boot() |
||
15 | { |
||
16 | |||
17 | if (class_exists('\App')) { |
||
18 | $lang = \App::getLocale(); |
||
19 | } else { |
||
20 | $lang = /** @scrutinizer ignore-call */ |
||
21 | app('translator')->getLocale(); |
||
22 | } |
||
23 | |||
24 | $this->publishes([ |
||
25 | __DIR__ . '/../errors/lang/' . $lang . '.php' => config_path($lang . '.php'), |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
26 | ]); |
||
27 | |||
28 | } |
||
29 | |||
30 | |||
31 | /** |
||
32 | * Register any package services. |
||
33 | * |
||
34 | * @return void |
||
35 | */ |
||
36 | public function register() |
||
37 | { |
||
38 | |||
39 | $this->registerMessages(); |
||
40 | |||
41 | } |
||
42 | |||
43 | private function registerMessages() |
||
44 | { |
||
45 | |||
46 | $this->app->bind('Vahid\Respond\Messages', function () { |
||
47 | |||
48 | return new Messages(); |
||
49 | |||
50 | }); |
||
51 | |||
52 | } |
||
53 | |||
54 | } |
||
55 |