2014-11-16 23:59:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
View::composer('index', function($view) {
|
|
|
|
$date = date('Y-m-d');
|
2014-11-17 00:09:35 +00:00
|
|
|
|
|
|
|
$incidents = Incident::whereRaw('DATE(created_at) = "' . $date . '"')
|
2014-11-16 23:59:14 +00:00
|
|
|
->groupBy('status')
|
2014-11-17 00:09:35 +00:00
|
|
|
->orderBy('status', 'desc');
|
2014-11-16 23:59:14 +00:00
|
|
|
|
2014-11-17 00:09:35 +00:00
|
|
|
if ($incidents->count() === 0 || (int) $incident->first()->status === 4) {
|
2014-11-16 23:59:14 +00:00
|
|
|
$status = 'success';
|
|
|
|
$message = 'All systems are functional.';
|
|
|
|
} else {
|
|
|
|
$status = 'error';
|
|
|
|
$message = 'Some systems are experiencing issues.';
|
|
|
|
}
|
|
|
|
|
|
|
|
$view->with([
|
|
|
|
'systemStatus' => $status,
|
|
|
|
'systemMessage' => $message
|
|
|
|
]);
|
|
|
|
});
|