diff --git a/app/view-composers.php b/app/view-composers.php index 8d576a67..6b7f0742 100644 --- a/app/view-composers.php +++ b/app/view-composers.php @@ -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 {