refactor: do not catch exceptions when cannot read options

This commit is contained in:
Steven Qiu 2026-03-09 20:21:43 +08:00
parent d70b39f445
commit 9aa867e8aa
No known key found for this signature in database
GPG Key ID: 8ACE9DCFC76F38B9

View File

@ -20,13 +20,9 @@ class Option
return;
}
try {
$this->items = DB::table('options')
->get()
->mapWithKeys(fn ($item) => [$item->option_name => $item->option_value]);
} catch (QueryException $e) {
$this->items = collect();
}
$this->items = DB::table('options')
->get()
->mapWithKeys(fn ($item) => [$item->option_name => $item->option_value]);
}
public function get($key, $default = null, $raw = false)