@@ -114,11 +114,11 @@ |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | - * Check if setting exists |
|
118 | - * |
|
119 | - * @param $key |
|
120 | - * @return bool |
|
121 | - */ |
|
117 | + * Check if setting exists |
|
118 | + * |
|
119 | + * @param $key |
|
120 | + * @return bool |
|
121 | + */ |
|
122 | 122 | public static function has(string $key) : bool |
123 | 123 | { |
124 | 124 | return (boolean) isset(self::allSettings()[$key]); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $value = str_replace('ç€π', '\\', $value); |
159 | 159 | $value = str_replace('@ƻ', '/', $value); |
160 | 160 | case 'string': |
161 | - $value = trim($value, '"'); |
|
161 | + $value = trim($value, '"'); |
|
162 | 162 | default: |
163 | 163 | return (string) $value; |
164 | 164 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | if ($setting->type === 'boolean' && is_string($value)) { |
240 | 240 | $value = ($value === 'false') ? false : $value; |
241 | - $value = ($value === 'true') ? true : $value; |
|
241 | + $value = ($value === 'true') ? true : $value; |
|
242 | 242 | } |
243 | 243 | if ($setting->type === 'integer' && is_string($value) && ctype_digit($value)) { |
244 | 244 | $value = (int) $value; |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public static function allSettings() : array |
278 | 278 | { |
279 | - if (! static::$all_settings) { |
|
280 | - static::$all_settings = Cache::rememberForever('settings.all', function () { |
|
279 | + if (!static::$all_settings) { |
|
280 | + static::$all_settings = Cache::rememberForever('settings.all', function() { |
|
281 | 281 | return self::all()->keyBy('key')->toArray(); |
282 | 282 | }); |
283 | 283 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | public static function getValidationRules() : array |
310 | 310 | { |
311 | 311 | if ('mysql' === \DB::connection()->getPDO()->getAttribute(\PDO::ATTR_DRIVER_NAME)) { |
312 | - return Cache::rememberForever('settings.rules', function () { |
|
312 | + return Cache::rememberForever('settings.rules', function() { |
|
313 | 313 | return Setting::select(\DB::raw('concat_ws("|", rules, type) as rules')) |
314 | 314 | ->select('key') |
315 | 315 | ->get() |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | }); |
318 | 318 | } |
319 | 319 | |
320 | - return Cache::rememberForever('settings.rules', function () { |
|
320 | + return Cache::rememberForever('settings.rules', function() { |
|
321 | 321 | return Setting::select(\DB::raw("printf('%s|%s', rules, type) as rules, `key`")) |
322 | 322 | ->pluck('rules', 'key') |
323 | 323 | ->toArray(); |
@@ -342,15 +342,15 @@ discard block |
||
342 | 342 | { |
343 | 343 | parent::boot(); |
344 | 344 | |
345 | - static::deleted(function () { |
|
345 | + static::deleted(function() { |
|
346 | 346 | self::flushCache(); |
347 | 347 | static::$all_settings = []; |
348 | 348 | }); |
349 | - static::updated(function () { |
|
349 | + static::updated(function() { |
|
350 | 350 | self::flushCache(); |
351 | 351 | static::$all_settings = []; |
352 | 352 | }); |
353 | - static::created(function () { |
|
353 | + static::created(function() { |
|
354 | 354 | self::flushCache(); |
355 | 355 | static::$all_settings = []; |
356 | 356 | }); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | ], 'config'); |
14 | 14 | |
15 | 15 | $this->publishes([ |
16 | - __DIR__ . '/../database/migrations/0000_00_00__create_settings_table.php' => base_path() . '/database/migrations/'. date('Y_m_d_His', time()) . '_create_settings_table.php' |
|
16 | + __DIR__ . '/../database/migrations/0000_00_00__create_settings_table.php' => base_path() . '/database/migrations/' . date('Y_m_d_His', time()) . '_create_settings_table.php' |
|
17 | 17 | ], 'migrations'); |
18 | 18 | } |
19 | 19 |
@@ -2,14 +2,14 @@ |
||
2 | 2 | |
3 | 3 | use \Ottosmops\Settings\Setting; |
4 | 4 | |
5 | -if (! function_exists('setting')) { |
|
5 | +if (!function_exists('setting')) { |
|
6 | 6 | function setting($key, $default = null) |
7 | 7 | { |
8 | 8 | return Setting::getValue($key, $default); |
9 | 9 | } |
10 | 10 | } |
11 | 11 | |
12 | -if (! function_exists('settingAsString')) { |
|
12 | +if (!function_exists('settingAsString')) { |
|
13 | 13 | function settingAsString($key, $default = null) |
14 | 14 | { |
15 | 15 | return Setting::getValueAsString($key, $default); |