Fixed the status alert

This commit is contained in:
James Brooks
2014-12-22 11:34:36 +00:00
parent a76424b195
commit f0953a4669

View File

@@ -3,13 +3,10 @@
View::composer('index', function ($view) {
$date = date('Y-m-d');
$incidents = Incident::whereRaw('DATE(created_at) = "'.$date.'"')
->groupBy('status')
->orderBy('status', 'desc');
$incidents = Incident::orderBy('created_at', 'desc')->get();
$incidentCount = $incidents->count();
if ($incidentCount <= 1 || ($incidentCount > 1 && (int) $incidents->first()->status === 4)) {
if ($incidentCount === 0 || ($incidentCount > 1 && (int) $incidents->first()->status === 4)) {
$status = 'success';
$message = Lang::get('cachet.service.good');
} else {