[UTIL] Update Common::config to ensure the values queried exist

This commit is contained in:
Hugo Sales 2020-07-22 09:41:09 +00:00 committed by Hugo Sales
parent ae373c7d96
commit 8ce0f05371
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 6 additions and 1 deletions

View File

@ -40,7 +40,12 @@ abstract class Common
*/
public static function config(string $section, string $setting)
{
return unserialize(DB::find('config', ['section' => $section, 'setting' => $setting])->getValue());
$c = DB::find('config', ['section' => $section, 'setting' => $setting]);
if ($c === null) {
throw new Exception("The field section = {$section} and setting = {$setting} doesn't exist");
}
return unserialize($c->getValue());
}
/**