Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
TranslationServiceProvider | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
register | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
2 | |||
boot | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Hyde\Publications\Providers; |
6 | |
7 | use Illuminate\Translation\TranslationServiceProvider as IlluminateTranslationServiceProvider; |
8 | |
9 | use function config; |
10 | use function is_dir; |
11 | use function lang_path; |
12 | |
13 | class TranslationServiceProvider extends IlluminateTranslationServiceProvider |
14 | { |
15 | public function register(): void |
16 | { |
17 | parent::register(); |
18 | |
19 | if (! is_dir(lang_path())) { |
20 | $this->app->useLangPath(__DIR__.'/../../resources/lang'); |
21 | } |
22 | |
23 | config([ |
24 | 'app.locale' => config('app.locale', 'en'), |
25 | 'app.fallback_locale' => config('app.fallback_locale', 'en'), |
26 | ]); |
27 | } |
28 | |
29 | public function boot(): void |
30 | { |
31 | $this->loadTranslationsFrom(__DIR__.'/../../resources/lang/en/validation.php', 'validation'); |
32 | } |
33 | } |