1 | <?php |
||||
2 | |||||
3 | namespace Laraplus\Data; |
||||
4 | |||||
5 | use Illuminate\Support\ServiceProvider; |
||||
6 | |||||
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'); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
32 | }); |
||||
33 | } |
||||
34 | |||||
35 | /** |
||||
36 | * Boot the service provider. |
||||
37 | * |
||||
38 | * @return void |
||||
39 | */ |
||||
40 | public function boot() |
||||
41 | { |
||||
42 | $config = dirname(__DIR__).'/config/translatable.php'; |
||||
43 | |||||
44 | $this->mergeConfigFrom($config, 'translatable'); |
||||
45 | $this->publishes([$config => config_path('translatable.php')], 'config'); |
||||
0 ignored issues
–
show
The function
config_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
46 | |||||
47 | TranslatableConfig::setDbSettings( |
||||
48 | $this->app['config']->get('translatable.db_settings') |
||||
49 | ); |
||||
50 | |||||
51 | TranslatableConfig::setDefaults( |
||||
52 | $this->app['config']->get('translatable.defaults') |
||||
53 | ); |
||||
54 | } |
||||
55 | } |
||||
56 |