Cachet/app/view-composers.php
Graham Campbell 9d8d89248f CS fixes
2014-12-20 21:20:17 +00:00

25 lines
676 B
PHP

<?php
View::composer('index', function ($view) {
$date = date('Y-m-d');
$incidents = Incident::whereRaw('DATE(created_at) = "'.$date.'"')
->groupBy('status')
->orderBy('status', 'desc');
$incidentCount = $incidents->count();
if ($incidentCount <= 1 || ($incidentCount > 1 && (int) $incidents->first()->status === 4)) {
$status = 'success';
$message = Lang::get('cachet.service.good');
} else {
$status = 'danger';
$message = Lang::get('cachet.service.bad');
}
$view->with([
'systemStatus' => $status,
'systemMessage' => $message,
]);
});