@@ -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]); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public static function allSettings() : array |
| 185 | 185 | { |
| 186 | - return Cache::rememberForever('settings.all', function () { |
|
| 186 | + return Cache::rememberForever('settings.all', function() { |
|
| 187 | 187 | return $settings = self::all()->keyBy('key')->toArray(); |
| 188 | 188 | |
| 189 | 189 | foreach ($settings as $setting) { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | public static function getValidationRules() : array |
| 213 | 213 | { |
| 214 | 214 | if ('mysql' === \DB::connection()->getPDO()->getAttribute(\PDO::ATTR_DRIVER_NAME)) { |
| 215 | - return Cache::rememberForever('settings.rules', function () { |
|
| 215 | + return Cache::rememberForever('settings.rules', function() { |
|
| 216 | 216 | return Setting::select(\DB::raw('concat(rules, "|", type) as rules, `key`')) |
| 217 | 217 | ->pluck('rules', 'key') |
| 218 | 218 | ->toArray(); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | |
| 223 | - return Cache::rememberForever('settings.rules', function () { |
|
| 223 | + return Cache::rememberForever('settings.rules', function() { |
|
| 224 | 224 | return Setting::select(\DB::raw("printf('%s|%s', rules, type) as rules, `key`")) |
| 225 | 225 | ->pluck('rules', 'key') |
| 226 | 226 | ->toArray(); |
@@ -244,13 +244,13 @@ discard block |
||
| 244 | 244 | { |
| 245 | 245 | parent::boot(); |
| 246 | 246 | |
| 247 | - static::deleted(function () { |
|
| 247 | + static::deleted(function() { |
|
| 248 | 248 | self::flushCache(); |
| 249 | 249 | }); |
| 250 | - static::updated(function () { |
|
| 250 | + static::updated(function() { |
|
| 251 | 251 | self::flushCache(); |
| 252 | 252 | }); |
| 253 | - static::created(function () { |
|
| 253 | + static::created(function() { |
|
| 254 | 254 | self::flushCache(); |
| 255 | 255 | }); |
| 256 | 256 | } |
@@ -2,7 +2,7 @@ |
||
| 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); |
@@ -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 | |