@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | __DIR__.'/../config/variables.php' => config_path('variables.php'), |
19 | 19 | ], 'variables-config'); |
20 | 20 | |
21 | - if (! class_exists('CreateVariablesTable')) { |
|
21 | + if (!class_exists('CreateVariablesTable')) { |
|
22 | 22 | $timestamp = date('Y_m_d_His', time()); |
23 | 23 | |
24 | 24 | $this->publishes([ |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->mergeConfigFrom(__DIR__.'/../config/variables.php', 'variables'); |
47 | 47 | |
48 | - $this->app->singleton(VariableManagerContract::class, function () { |
|
48 | + $this->app->singleton(VariableManagerContract::class, function() { |
|
49 | 49 | $cacheRepo = $this->app->make(\Illuminate\Cache\Repository::class); |
50 | 50 | return new VariableManager(new Variable, $cacheRepo, $this->app); |
51 | 51 | }); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | protected function replaceConfigsWithVariables() |
55 | 55 | { |
56 | - $this->app->booted(function () { |
|
56 | + $this->app->booted(function() { |
|
57 | 57 | |
58 | 58 | // package config |
59 | 59 | $config = $this->app['config']->get('variables'); |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | $variables = $this->app->make(VariableManagerContract::class)->all(); |
67 | 67 | |
68 | 68 | foreach ($variables as $varKey => $varValue) { |
69 | - $configKey = $variableConfig[$varKey] ?? ($config['config_key_for_vars'] . '.' . $varKey) ?? ''; |
|
70 | - if (! empty($variableConfig[$varKey])) { |
|
69 | + $configKey = $variableConfig[$varKey] ?? ($config['config_key_for_vars'].'.'.$varKey) ?? ''; |
|
70 | + if (!empty($variableConfig[$varKey])) { |
|
71 | 71 | $this->app['config']->set($variableConfig[$varKey], $varValue); |
72 | 72 | } |
73 | - if (! empty($config['config_key_for_vars'])) { |
|
74 | - $this->app['config']->set($config['config_key_for_vars'] . '.' . $varKey, $varValue); |
|
73 | + if (!empty($config['config_key_for_vars'])) { |
|
74 | + $this->app['config']->set($config['config_key_for_vars'].'.'.$varKey, $varValue); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | } catch (\Exception $exception) { |
78 | - $this->app['log']->info(__CLASS__ . ' - ' . $exception->getMessage()); |
|
78 | + $this->app['log']->info(__CLASS__.' - '.$exception->getMessage()); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | }); |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct($variableModel, $cacheRepository, $app = null) |
28 | 28 | { |
29 | - if (! $app) { |
|
30 | - $app = app(); //Fallback when $app is not given |
|
29 | + if (!$app) { |
|
30 | + $app = app(); //Fallback when $app is not given |
|
31 | 31 | } |
32 | 32 | $this->app = $app; |
33 | 33 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | try { |
49 | 49 | return $this->all()[$key] ?? $default; |
50 | 50 | } catch (\Exception $exception) { |
51 | - $this->app['log']->info(__CLASS__ . ' - ' . $exception->getMessage()); |
|
51 | + $this->app['log']->info(__CLASS__.' - '.$exception->getMessage()); |
|
52 | 52 | |
53 | 53 | return $default; |
54 | 54 | } |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function all(): array |
61 | 61 | { |
62 | - if (! isset($this->variables)) { |
|
62 | + if (!isset($this->variables)) { |
|
63 | 63 | |
64 | - $all = $this->cacheRepository->remember($this->config['cache']['name'], $this->config['cache']['time'], function () { |
|
64 | + $all = $this->cacheRepository->remember($this->config['cache']['name'], $this->config['cache']['time'], function() { |
|
65 | 65 | return $this->variableModel->select('key', 'value', 'locale')->get(); |
66 | 66 | }); |
67 | 67 |