@@ -34,7 +34,7 @@ |
||
| 34 | 34 | public function getSettingsValue(): array |
| 35 | 35 | { |
| 36 | 36 | if (config('model_settings.settings_table_use_cache')) { |
| 37 | - return Cache::rememberForever($this->getSettingsCacheKey(), function () { |
|
| 37 | + return Cache::rememberForever($this->getSettingsCacheKey(), function() { |
|
| 38 | 38 | return $this->__getSettingsValue(); |
| 39 | 39 | }); |
| 40 | 40 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | protected static function bootHasSettingsField() |
| 26 | 26 | { |
| 27 | - static::saving(function ($model) { |
|
| 27 | + static::saving(function($model) { |
|
| 28 | 28 | /** @var self $model */ |
| 29 | 29 | $model->fixSettingsValue(); |
| 30 | 30 | }); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | return Cache::remember( |
| 108 | 108 | config('model_settings.settings_table_cache_prefix') . '::has_field', |
| 109 | 109 | now()->addDays(1), |
| 110 | - function () { |
|
| 110 | + function() { |
|
| 111 | 111 | return Schema::connection($this->getConnectionName()) |
| 112 | 112 | ->hasColumn( |
| 113 | 113 | $this->getTable(), |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | foreach ($paths as $path) { |
| 143 | - // Get default value |
|
| 144 | - $defaultValue = null; |
|
| 145 | - if(is_array($default)){ |
|
| 146 | - $defaultValue = Arr::get($default, $path); |
|
| 147 | - }else{ |
|
| 148 | - $defaultValue = $default; |
|
| 149 | - } |
|
| 143 | + // Get default value |
|
| 144 | + $defaultValue = null; |
|
| 145 | + if(is_array($default)){ |
|
| 146 | + $defaultValue = Arr::get($default, $path); |
|
| 147 | + }else{ |
|
| 148 | + $defaultValue = $default; |
|
| 149 | + } |
|
| 150 | 150 | Arr::set($array, $path, Arr::get($allFlattened, $path, $defaultValue)); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -172,29 +172,29 @@ discard block |
||
| 172 | 172 | return $this->apply($settings); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - /** |
|
| 176 | - * |
|
| 177 | - */ |
|
| 175 | + /** |
|
| 176 | + * |
|
| 177 | + */ |
|
| 178 | 178 | protected function forgetEmpty(&$settings, $path) { |
| 179 | - // Forget path if it is empty |
|
| 180 | - if(!Arr::get($settings, $path)){ |
|
| 181 | - Arr::forget($settings, $path); |
|
| 182 | - }else{ |
|
| 183 | - return; |
|
| 184 | - } |
|
| 179 | + // Forget path if it is empty |
|
| 180 | + if(!Arr::get($settings, $path)){ |
|
| 181 | + Arr::forget($settings, $path); |
|
| 182 | + }else{ |
|
| 183 | + return; |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | - // Get path as array |
|
| 187 | - $paths = explode('.', $path); |
|
| 186 | + // Get path as array |
|
| 187 | + $paths = explode('.', $path); |
|
| 188 | 188 | |
| 189 | - // remove last path |
|
| 190 | - array_pop($paths); |
|
| 189 | + // remove last path |
|
| 190 | + array_pop($paths); |
|
| 191 | 191 | |
| 192 | - // Return if it was the last |
|
| 193 | - if(count($paths) === 0){ |
|
| 194 | - return; |
|
| 195 | - } |
|
| 192 | + // Return if it was the last |
|
| 193 | + if(count($paths) === 0){ |
|
| 194 | + return; |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | - $this->forgetEmpty($settings, implode('.', $paths)); |
|
| 197 | + $this->forgetEmpty($settings, implode('.', $paths)); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public function all(): array |
| 78 | 78 | { |
| 79 | 79 | if (config('model_settings.settings_cache_all') && !($this instanceof RedisSettingsManager)) { |
| 80 | - return Cache::remember($this->getAllSettingsCacheKey(), now()->addDay(), function () { |
|
| 80 | + return Cache::remember($this->getAllSettingsCacheKey(), now()->addDay(), function() { |
|
| 81 | 81 | return $this->getMultiple(null); |
| 82 | 82 | }); |
| 83 | 83 | } |
@@ -149,9 +149,9 @@ discard block |
||
| 149 | 149 | foreach ($paths as $path) { |
| 150 | 150 | // Get default value |
| 151 | 151 | $defaultValue = null; |
| 152 | - if(is_array($default)){ |
|
| 152 | + if (is_array($default)) { |
|
| 153 | 153 | $defaultValue = Arr::get($default, $path); |
| 154 | - }else{ |
|
| 154 | + } else { |
|
| 155 | 155 | $defaultValue = $default; |
| 156 | 156 | } |
| 157 | 157 | Arr::set($array, $path, Arr::get($allFlattened, $path, $defaultValue)); |
@@ -184,9 +184,9 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | protected function forgetEmpty(&$settings, $path) { |
| 186 | 186 | // Forget path if it is empty |
| 187 | - if(!Arr::get($settings, $path)){ |
|
| 187 | + if (!Arr::get($settings, $path)) { |
|
| 188 | 188 | Arr::forget($settings, $path); |
| 189 | - }else{ |
|
| 189 | + } else { |
|
| 190 | 190 | return; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | array_pop($paths); |
| 198 | 198 | |
| 199 | 199 | // Return if it was the last |
| 200 | - if(count($paths) === 0){ |
|
| 200 | + if (count($paths) === 0) { |
|
| 201 | 201 | return; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $defaultValue = null; |
| 152 | 152 | if(is_array($default)){ |
| 153 | 153 | $defaultValue = Arr::get($default, $path); |
| 154 | - }else{ |
|
| 154 | + } else{ |
|
| 155 | 155 | $defaultValue = $default; |
| 156 | 156 | } |
| 157 | 157 | Arr::set($array, $path, Arr::get($allFlattened, $path, $defaultValue)); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | // Forget path if it is empty |
| 187 | 187 | if(!Arr::get($settings, $path)){ |
| 188 | 188 | Arr::forget($settings, $path); |
| 189 | - }else{ |
|
| 189 | + } else{ |
|
| 190 | 190 | return; |
| 191 | 191 | } |
| 192 | 192 | |