diff --git a/app/models/Setting.php b/app/models/Setting.php index 38e661f7..5685975f 100644 --- a/app/models/Setting.php +++ b/app/models/Setting.php @@ -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; } } diff --git a/app/view-composers.php b/app/view-composers.php index e83a1f26..8ca86171 100644 --- a/app/view-composers.php +++ b/app/view-composers.php @@ -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 {