From 57c64f6fbefde5082660b45f79a9dca9076ea0b3 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Mon, 17 Nov 2014 00:09:35 +0000 Subject: [PATCH] Fix systemStatus view composer --- app/view-composers.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/view-composers.php b/app/view-composers.php index 198d5823..c28ee596 100644 --- a/app/view-composers.php +++ b/app/view-composers.php @@ -2,12 +2,12 @@ View::composer('index', function($view) { $date = date('Y-m-d'); - $incident = Incident::whereRaw('DATE(created_at) = "' . $date . '"') - ->groupBy('status') - ->orderBy('status', 'desc') - ->first(); - if ((int) $incident->status === 4) { + $incidents = Incident::whereRaw('DATE(created_at) = "' . $date . '"') + ->groupBy('status') + ->orderBy('status', 'desc'); + + if ($incidents->count() === 0 || (int) $incident->first()->status === 4) { $status = 'success'; $message = 'All systems are functional.'; } else {