Code Duplication    Length = 8-8 lines in 2 locations

src/Commands/SettingsCache.php 1 location

@@ 56-63 (lines=8) @@
53
54
        if (isset($model)) {
55
            $users = (new $model)->all();
56
            foreach ($users as $user) {
57
                $settings = $user->allSettings();
58
                foreach ($settings as $key => $value) {
59
                    $cache_key = $user->settingsCacheKey($key);
60
61
                    Cache::put($cache_key, $value, $duration);
62
                }
63
            }
64
        }
65
66
        $this->info('Cached all settings');

src/Commands/SettingsClear.php 1 location

@@ 55-62 (lines=8) @@
52
53
        if (isset($model)) {
54
            $users = (new $model)->all();
55
            foreach ($users as $user) {
56
                $settings = $user->allSettings();
57
                foreach ($settings as $key => $value) {
58
                    $cache_key = $user->settingsCacheKey($key);
59
60
                    Cache::forget($cache_key);
61
                }
62
            }
63
        }
64
65
        $this->info('Cleared ' . count($settings) . ' settings cache.');