Conditions | 2 |
Paths | 2 |
Total Lines | 24 |
Code Lines | 12 |
Lines | 9 |
Ratio | 37.5 % |
Tests | 15 |
CRAP Score | 2 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
40 | 4 | public function handle() |
|
41 | { |
||
42 | 4 | $this->comment('Clearing settings cache.'); |
|
43 | |||
44 | 4 | Settings::all()->each(function ($value, $key) { |
|
45 | 2 | $cache_key = Settings::cacheKey($key); |
|
46 | |||
47 | 2 | Cache::forget($cache_key); |
|
48 | 4 | }); |
|
49 | |||
50 | 4 | $model = $this->option('model'); |
|
51 | |||
52 | 4 | View Code Duplication | if (isset($model)) { |
53 | (new $model)->all()->each(function ($user) { |
||
54 | 2 | $user->allSettings()->each(function ($value, $key) use ($user) { |
|
55 | 2 | $cache_key = $user->settingsCacheKey($key); |
|
56 | |||
57 | 2 | Cache::forget($cache_key); |
|
58 | 2 | }); |
|
59 | 2 | }); |
|
60 | } |
||
61 | |||
62 | 4 | $this->info('Cleared settings cache.'); |
|
63 | 4 | } |
|
64 | } |
||
65 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.