[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
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0

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());
}
/**