Total Complexity | 3 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class TranslatableServiceProvider extends ServiceProvider |
||
8 | { |
||
9 | /** |
||
10 | * Register the service provider. |
||
11 | * |
||
12 | * @return void |
||
13 | */ |
||
14 | public function register() |
||
15 | { |
||
16 | TranslatableConfig::cacheGetter(function ($table) { |
||
17 | return $this->app['cache']->get('translatable.'.$table); |
||
18 | }); |
||
19 | |||
20 | TranslatableConfig::cacheSetter(function ($table, $fields) { |
||
21 | return $this->app['cache']->forever('translatable.'.$table, $fields); |
||
22 | }); |
||
23 | |||
24 | TranslatableConfig::currentLocaleGetter(function () { |
||
25 | return $this->app->getLocale(); |
||
26 | }); |
||
27 | |||
28 | TranslatableConfig::fallbackLocaleGetter(function () { |
||
29 | return method_exists($this->app, 'getFallbackLocale') |
||
30 | ? $this->app->getFallbackLocale() |
||
31 | : config('app.fallback_locale'); |
||
|
|||
32 | }); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Boot the service provider. |
||
37 | * |
||
38 | * @return void |
||
39 | */ |
||
40 | public function boot() |
||
53 | ); |
||
54 | } |
||
56 |