@@ -23,6 +23,6 @@ |
||
| 23 | 23 | |
| 24 | 24 | $variable = $variableMng->locale($this->argument('locale'))->get($this->argument('name')); |
| 25 | 25 | |
| 26 | - print_r($variable . "\n"); |
|
| 26 | + print_r($variable."\n"); |
|
| 27 | 27 | } |
| 28 | 28 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('variable')) { |
|
| 3 | +if (!function_exists('variable')) { |
|
| 4 | 4 | /** |
| 5 | 5 | * @param $name |
| 6 | 6 | * @param null $default |
@@ -25,9 +25,9 @@ |
||
| 25 | 25 | | ----------------------------------------------------------------- |
| 26 | 26 | */ |
| 27 | 27 | 'variable_config' => [ |
| 28 | - 'app_name' => 'app.name', // config('app.name') |
|
| 29 | - 'app_description' => 'app.description', // config('app.description') |
|
| 30 | - 'some_var' => 'services.some.var', // config('services.some.var') |
|
| 28 | + 'app_name' => 'app.name', // config('app.name') |
|
| 29 | + 'app_description' => 'app.description', // config('app.description') |
|
| 30 | + 'some_var' => 'services.some.var', // config('services.some.var') |
|
| 31 | 31 | ], |
| 32 | 32 | |
| 33 | 33 | /* ----------------------------------------------------------------- |
@@ -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'); |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | $variables = $this->app->make(VariableManagerContract::class)->all(); |
| 66 | 66 | |
| 67 | 67 | foreach ($variables as $varKey => $varValue) { |
| 68 | - if (! empty($variableConfig[$varKey])) { |
|
| 68 | + if (!empty($variableConfig[$varKey])) { |
|
| 69 | 69 | $this->app['config']->set($variableConfig[$varKey], $varValue); |
| 70 | 70 | } |
| 71 | - if (! empty($config['config_key_for_vars'])) { |
|
| 72 | - $this->app['config']->set($config['config_key_for_vars'] . '.' . $varKey, $varValue); |
|
| 71 | + if (!empty($config['config_key_for_vars'])) { |
|
| 72 | + $this->app['config']->set($config['config_key_for_vars'].'.'.$varKey, $varValue); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | } catch (\Exception $exception) { |
@@ -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 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | if ($useCache === false) { |
| 49 | 49 | $var = $this->variableModel->where('key', $key) |
| 50 | - ->when($this->locale, function ($q) { |
|
| 50 | + ->when($this->locale, function($q) { |
|
| 51 | 51 | $q->where('locale', $this->locale); |
| 52 | 52 | }) |
| 53 | 53 | ->first(); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function all(): array |
| 77 | 77 | { |
| 78 | - $all = $this->cacheRepository->remember($this->config['cache']['name'], $this->config['cache']['time'], function () { |
|
| 78 | + $all = $this->cacheRepository->remember($this->config['cache']['name'], $this->config['cache']['time'], function() { |
|
| 79 | 79 | return $this->getCollection(); |
| 80 | 80 | }); |
| 81 | 81 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | try { |
| 119 | 119 | return $this->variableModel->select('key', 'value', 'locale')->get(); |
| 120 | 120 | } catch (\Exception $exception) { |
| 121 | - $this->app['log']->info(__CLASS__ . ': ' . $exception->getMessage()); |
|
| 121 | + $this->app['log']->info(__CLASS__.': '.$exception->getMessage()); |
|
| 122 | 122 | |
| 123 | 123 | return false; |
| 124 | 124 | } |