@@ -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]); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public static function allSettings() : array |
188 | 188 | { |
189 | - return Cache::rememberForever('settings.all', function () { |
|
189 | + return Cache::rememberForever('settings.all', function() { |
|
190 | 190 | return $settings = self::all()->keyBy('key')->toArray(); |
191 | 191 | |
192 | 192 | foreach ($settings as $setting) { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | public static function getValidationRules() : array |
216 | 216 | { |
217 | 217 | if ('mysql' === \DB::connection()->getPDO()->getAttribute(\PDO::ATTR_DRIVER_NAME)) { |
218 | - return Cache::rememberForever('settings.rules', function () { |
|
218 | + return Cache::rememberForever('settings.rules', function() { |
|
219 | 219 | return Setting::select(\DB::raw('concat(rules, "|", $type) as rules, key')) |
220 | 220 | ->pluck('rules', 'key') |
221 | 221 | ->toArray(); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } |
224 | 224 | |
225 | 225 | |
226 | - return Cache::rememberForever('settings.rules', function () { |
|
226 | + return Cache::rememberForever('settings.rules', function() { |
|
227 | 227 | return Setting::select(\DB::raw("printf('%s|%s', rules, type) as rules, key")) |
228 | 228 | ->pluck('rules', 'key') |
229 | 229 | ->toArray(); |
@@ -247,13 +247,13 @@ discard block |
||
247 | 247 | { |
248 | 248 | parent::boot(); |
249 | 249 | |
250 | - static::deleted(function () { |
|
250 | + static::deleted(function() { |
|
251 | 251 | self::flushCache(); |
252 | 252 | }); |
253 | - static::updated(function () { |
|
253 | + static::updated(function() { |
|
254 | 254 | self::flushCache(); |
255 | 255 | }); |
256 | - static::created(function () { |
|
256 | + static::created(function() { |
|
257 | 257 | self::flushCache(); |
258 | 258 | }); |
259 | 259 | } |
@@ -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); |
@@ -10,12 +10,12 @@ |
||
10 | 10 | { |
11 | 11 | $this->publishes([ |
12 | 12 | __DIR__ . '/../database/migrations/' => base_path('/database/migrations'), |
13 | - __DIR__.'/../config/settings.php' => config_path('settings.php'), |
|
13 | + __DIR__ . '/../config/settings.php' => config_path('settings.php'), |
|
14 | 14 | ]); |
15 | 15 | } |
16 | 16 | |
17 | 17 | public function register() |
18 | 18 | { |
19 | - $configPath = __DIR__ . '/../config/settings.php'; |
|
19 | + $configPath = __DIR__ . '/../config/settings.php'; |
|
20 | 20 | } |
21 | 21 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | public function up() |
30 | 30 | { |
31 | - Schema::create($this->table, function (Blueprint $table) { |
|
31 | + Schema::create($this->table, function(Blueprint $table) { |
|
32 | 32 | $table->string('key')->primary(); |
33 | 33 | $table->text('value')->nullable(); |
34 | 34 | $table->string('type'); // string, integer, array, bool |