@@ -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]); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | if ($setting->type === 'boolean' && is_string($value)) { |
| 225 | 225 | $value = ($value === 'false') ? false : $value; |
| 226 | - $value = ($value === 'true') ? true : $value; |
|
| 226 | + $value = ($value === 'true') ? true : $value; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if ($validate && !$setting->validateNewValue($value)) { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | public static function allSettings() : array |
| 260 | 260 | { |
| 261 | - return Cache::rememberForever('settings.all', function () { |
|
| 261 | + return Cache::rememberForever('settings.all', function() { |
|
| 262 | 262 | return $settings = self::all()->keyBy('key')->toArray(); |
| 263 | 263 | }); |
| 264 | 264 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | public static function getValidationRules() : array |
| 283 | 283 | { |
| 284 | 284 | if ('mysql' === \DB::connection()->getPDO()->getAttribute(\PDO::ATTR_DRIVER_NAME)) { |
| 285 | - return Cache::rememberForever('settings.rules', function () { |
|
| 285 | + return Cache::rememberForever('settings.rules', function() { |
|
| 286 | 286 | return Setting::select(\DB::raw('concat_ws("|", rules, type) as rules, `key`')) |
| 287 | 287 | ->pluck('rules', 'key') |
| 288 | 288 | ->toArray(); |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | |
| 293 | - return Cache::rememberForever('settings.rules', function () { |
|
| 293 | + return Cache::rememberForever('settings.rules', function() { |
|
| 294 | 294 | return Setting::select(\DB::raw("printf('%s|%s', rules, type) as rules, `key`")) |
| 295 | 295 | ->pluck('rules', 'key') |
| 296 | 296 | ->toArray(); |
@@ -315,13 +315,13 @@ discard block |
||
| 315 | 315 | { |
| 316 | 316 | parent::boot(); |
| 317 | 317 | |
| 318 | - static::deleted(function () { |
|
| 318 | + static::deleted(function() { |
|
| 319 | 319 | self::flushCache(); |
| 320 | 320 | }); |
| 321 | - static::updated(function () { |
|
| 321 | + static::updated(function() { |
|
| 322 | 322 | self::flushCache(); |
| 323 | 323 | }); |
| 324 | - static::created(function () { |
|
| 324 | + static::created(function() { |
|
| 325 | 325 | self::flushCache(); |
| 326 | 326 | }); |
| 327 | 327 | } |
@@ -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); |