2014-11-16 23:59:14 +00:00
|
|
|
<?php
|
|
|
|
|
2014-12-20 21:20:17 +00:00
|
|
|
View::composer('index', function ($view) {
|
2014-12-01 08:42:11 +00:00
|
|
|
$date = date('Y-m-d');
|
2014-11-17 00:09:35 +00:00
|
|
|
|
2014-12-31 15:56:08 +00:00
|
|
|
$components = Component::notStatus(1);
|
2014-11-24 17:02:03 +00:00
|
|
|
|
2014-12-31 15:56:08 +00:00
|
|
|
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');
|
|
|
|
}
|
2014-12-01 08:42:11 +00:00
|
|
|
} else {
|
|
|
|
$status = 'danger';
|
2014-12-01 16:37:37 +00:00
|
|
|
$message = Lang::get('cachet.service.bad');
|
2014-12-01 08:42:11 +00:00
|
|
|
}
|
2014-11-16 23:59:14 +00:00
|
|
|
|
2014-12-01 08:42:11 +00:00
|
|
|
$view->with([
|
|
|
|
'systemStatus' => $status,
|
2014-12-20 21:20:17 +00:00
|
|
|
'systemMessage' => $message,
|
2014-12-01 08:42:11 +00:00
|
|
|
]);
|
2014-11-27 16:05:00 +00:00
|
|
|
});
|