Don't throw errors when fetching settings etc

This commit is contained in:
James Brooks
2014-11-19 16:50:54 +00:00
parent 4ab353c954
commit f4f5b6dbcb
2 changed files with 8 additions and 2 deletions

View File

@@ -2,6 +2,12 @@
class Setting extends Eloquent {
public static function get($settingName) {
return self::where('name', $settingName)->first()->value;
try {
$setting = self::where('name', $settingName)->first()->value;
} catch (ErrorException $e) {
$setting = null;
}
return $setting;
}
}

View File

@@ -7,7 +7,7 @@
->groupBy('status')
->orderBy('status', 'desc');
if ($incidents->get()->count() === 1 || (int) $incidents->first()->status === 4) {
if ($incidents->get()->count() <= 1 || ($incidents->get()->count() > 1 && (int) $incidents->first()->status === 4)) {
$status = 'success';
$message = 'All systems are functional.';
} else {