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:
parent
bfe6664d58
commit
dbba0865e8
1 changed files with 2 additions and 13 deletions
|
@ -45,8 +45,6 @@ if ( ! function_exists('setting'))
|
||||||
throw new InvalidArgumentException('The $key argument cannot be empty.');
|
throw new InvalidArgumentException('The $key argument cannot be empty.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache = config('settings');
|
|
||||||
|
|
||||||
if (is_array($key))
|
if (is_array($key))
|
||||||
{
|
{
|
||||||
foreach ($key as $name => $value)
|
foreach ($key as $name => $value)
|
||||||
|
@ -62,22 +60,13 @@ if ( ! function_exists('setting'))
|
||||||
}
|
}
|
||||||
|
|
||||||
$CI->settings_model->save($setting);
|
$CI->settings_model->save($setting);
|
||||||
|
|
||||||
$cache[$name] = $value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config(['settings' => $cache]);
|
|
||||||
|
|
||||||
return NULL;
|
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 $setting['value'] ?? $default;
|
||||||
}
|
|
||||||
|
|
||||||
return $cache[$key] ?? $default;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue