Smarter handling of the service status
This commit is contained in:
+13
-5
@@ -3,12 +3,20 @@
|
||||
View::composer('index', function ($view) {
|
||||
$date = date('Y-m-d');
|
||||
|
||||
$incidents = Incident::orderBy('created_at', 'desc')->get();
|
||||
$incidentCount = $incidents->count();
|
||||
$components = Component::notStatus(1);
|
||||
|
||||
if ($incidentCount === 0 || ($incidentCount > 1 && (int) $incidents->first()->status === 4)) {
|
||||
$status = 'success';
|
||||
$message = Lang::get('cachet.service.good');
|
||||
if (Component::all()->count() === 0 || $components->count() === 0) {
|
||||
// If all our components are ok, do we have any non-fixed incidents?
|
||||
$incidents = Incident::orderBy('created_at', 'desc')->get();
|
||||
$incidentCount = $incidents->count();
|
||||
|
||||
if ($incidentCount === 0 || ($incidentCount >= 1 && (int) $incidents->first()->status === 4)) {
|
||||
$status = 'success';
|
||||
$message = Lang::get('cachet.service.good');
|
||||
} else {
|
||||
$status = 'danger';
|
||||
$message = Lang::get('cachet.service.bad');
|
||||
}
|
||||
} else {
|
||||
$status = 'danger';
|
||||
$message = Lang::get('cachet.service.bad');
|
||||
|
||||
Reference in New Issue
Block a user