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-20 21:20:17 +00:00
|
|
|
$incidents = Incident::whereRaw('DATE(created_at) = "'.$date.'"')
|
2014-12-01 08:42:11 +00:00
|
|
|
->groupBy('status')
|
|
|
|
->orderBy('status', 'desc');
|
2014-11-16 23:59:14 +00:00
|
|
|
|
2014-12-01 08:42:11 +00:00
|
|
|
$incidentCount = $incidents->count();
|
2014-11-24 17:02:03 +00:00
|
|
|
|
2014-12-01 08:42:11 +00:00
|
|
|
if ($incidentCount <= 1 || ($incidentCount > 1 && (int) $incidents->first()->status === 4)) {
|
|
|
|
$status = 'success';
|
2014-12-01 16:37:37 +00:00
|
|
|
$message = Lang::get('cachet.service.good');
|
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
|
|
|
});
|