@@ -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]); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $value = str_replace('ç€π', '\\', $value); |
| 157 | 157 | $value = str_replace('@ƻ', '/', $value); |
| 158 | 158 | case 'string': |
| 159 | - $value = trim($value, '"'); |
|
| 159 | + $value = trim($value, '"'); |
|
| 160 | 160 | default: |
| 161 | 161 | return (string) $value; |
| 162 | 162 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | if ($setting->type === 'boolean' && is_string($value)) { |
| 238 | 238 | $value = ($value === 'false') ? false : $value; |
| 239 | - $value = ($value === 'true') ? true : $value; |
|
| 239 | + $value = ($value === 'true') ? true : $value; |
|
| 240 | 240 | } |
| 241 | 241 | if ($setting->type === 'integer' && is_string($value) && ctype_digit($value)) { |
| 242 | 242 | $value = (int) $value; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | */ |
| 275 | 275 | public static function allSettings() : array |
| 276 | 276 | { |
| 277 | - return Cache::rememberForever('settings.all', function () { |
|
| 277 | + return Cache::rememberForever('settings.all', function() { |
|
| 278 | 278 | return $settings = self::all()->keyBy('key')->toArray(); |
| 279 | 279 | }); |
| 280 | 280 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | public static function getValidationRules() : array |
| 303 | 303 | { |
| 304 | 304 | if ('mysql' === \DB::connection()->getPDO()->getAttribute(\PDO::ATTR_DRIVER_NAME)) { |
| 305 | - return Cache::rememberForever('settings.rules', function () { |
|
| 305 | + return Cache::rememberForever('settings.rules', function() { |
|
| 306 | 306 | return Setting::select(\DB::raw('concat_ws("|", rules, type) as rules, `key`')) |
| 307 | 307 | ->pluck('rules', 'key') |
| 308 | 308 | ->toArray(); |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | |
| 313 | - return Cache::rememberForever('settings.rules', function () { |
|
| 313 | + return Cache::rememberForever('settings.rules', function() { |
|
| 314 | 314 | return Setting::select(\DB::raw("printf('%s|%s', rules, type) as rules, `key`")) |
| 315 | 315 | ->pluck('rules', 'key') |
| 316 | 316 | ->toArray(); |
@@ -335,13 +335,13 @@ discard block |
||
| 335 | 335 | { |
| 336 | 336 | parent::boot(); |
| 337 | 337 | |
| 338 | - static::deleted(function () { |
|
| 338 | + static::deleted(function() { |
|
| 339 | 339 | self::flushCache(); |
| 340 | 340 | }); |
| 341 | - static::updated(function () { |
|
| 341 | + static::updated(function() { |
|
| 342 | 342 | self::flushCache(); |
| 343 | 343 | }); |
| 344 | - static::created(function () { |
|
| 344 | + static::created(function() { |
|
| 345 | 345 | self::flushCache(); |
| 346 | 346 | }); |
| 347 | 347 | } |
@@ -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); |