Removed caching from the settings helper as it may lead to unexpected behavior (if for example values get updated in another way).

This commit is contained in:
Alex Tselegidis 2021-12-17 09:01:12 +01:00
parent bfe6664d58
commit dbba0865e8
1 changed files with 2 additions and 13 deletions

View File

@ -45,8 +45,6 @@ if ( ! function_exists('setting'))
throw new InvalidArgumentException('The $key argument cannot be empty.');
}
$cache = config('settings');
if (is_array($key))
{
foreach ($key as $name => $value)
@ -62,22 +60,13 @@ if ( ! function_exists('setting'))
}
$CI->settings_model->save($setting);
$cache[$name] = $value;
}
config(['settings' => $cache]);
return NULL;
}
if (empty($cache[$key]))
{
$setting = $CI->settings_model->query()->where('name', $key)->get()->row_array();
$setting = $CI->settings_model->query()->where('name', $key)->get()->row_array();
$cache[$key] = $setting['value'] ?? NULL;
}
return $cache[$key] ?? $default;
return $setting['value'] ?? $default;
}
}