@@ -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 |
@@ -19,11 +19,11 @@ discard block |
||
| 19 | 19 | ], 'variables-config'); |
| 20 | 20 | |
| 21 | 21 | if (! class_exists('CreateVariablesTable')) { |
| 22 | - $timestamp = date('Y_m_d_His', time()); |
|
| 22 | + $timestamp = date('Y_m_d_His', time()); |
|
| 23 | 23 | |
| 24 | - $this->publishes([ |
|
| 25 | - __DIR__.'/../database/migrations/create_variables_table.php.stub' => $this->app->databasePath()."/migrations/{$timestamp}_create_variables_table.php", |
|
| 26 | - ], 'variables-migrations'); |
|
| 24 | + $this->publishes([ |
|
| 25 | + __DIR__.'/../database/migrations/create_variables_table.php.stub' => $this->app->databasePath()."/migrations/{$timestamp}_create_variables_table.php", |
|
| 26 | + ], 'variables-migrations'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | if ($this->app['config']->get('variables.config_key_for_vars')) { |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | if ($this->app->runningInConsole()) { |
| 34 | - $this->commands([ |
|
| 35 | - Commands\AllVariable::class, |
|
| 36 | - Commands\GetVariable::class, |
|
| 37 | - ]); |
|
| 34 | + $this->commands([ |
|
| 35 | + Commands\AllVariable::class, |
|
| 36 | + Commands\GetVariable::class, |
|
| 37 | + ]); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
@@ -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([ |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $this->mergeConfigFrom(__DIR__.'/../config/variables.php', 'variables'); |
| 49 | 49 | |
| 50 | - $this->app->singleton(VariableManagerContract::class, function () { |
|
| 50 | + $this->app->singleton(VariableManagerContract::class, function() { |
|
| 51 | 51 | $cacheRepo = $this->app->make(\Illuminate\Cache\Repository::class); |
| 52 | 52 | return new VariableManager(new Variable, $cacheRepo, $this->app); |
| 53 | 53 | }); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | protected function replaceConfigsWithVariables() |
| 57 | 57 | { |
| 58 | - $this->app->booted(function () { |
|
| 58 | + $this->app->booted(function() { |
|
| 59 | 59 | |
| 60 | 60 | // package config |
| 61 | 61 | $config = $this->app['config']->get('variables'); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | foreach ($variables as $varKey => $varValue) { |
| 69 | 69 | |
| 70 | - $configKey = $variableConfig[$varKey] ?? ($config['config_key_for_vars'] . '.' . $varKey); |
|
| 70 | + $configKey = $variableConfig[$varKey] ?? ($config['config_key_for_vars'].'.'.$varKey); |
|
| 71 | 71 | |
| 72 | 72 | $this->app['config']->set($configKey, $varValue); |
| 73 | 73 | } |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function __construct($variableModel, $cacheRepository, $app = null) |
| 26 | 26 | { |
| 27 | - if (! $app) { |
|
| 28 | - $app = app(); //Fallback when $app is not given |
|
| 27 | + if (!$app) { |
|
| 28 | + $app = app(); //Fallback when $app is not given |
|
| 29 | 29 | } |
| 30 | 30 | $this->app = $app; |
| 31 | 31 | |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function all(): array |
| 53 | 53 | { |
| 54 | - if (! isset($this->variables)) { |
|
| 54 | + if (!isset($this->variables)) { |
|
| 55 | 55 | |
| 56 | - $all = $this->cacheRepository->remember($this->config['cache']['name'], $this->config['cache']['time'], function () { |
|
| 56 | + $all = $this->cacheRepository->remember($this->config['cache']['name'], $this->config['cache']['time'], function() { |
|
| 57 | 57 | return $this->variableModel->select('key', 'value', 'locale')->get(); |
| 58 | 58 | }); |
| 59 | 59 | |
@@ -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 | /* ----------------------------------------------------------------- |