<?php

	View::composer('index', function($view) {
		$date = date('Y-m-d');

		$incidents = Incident::whereRaw('DATE(created_at) = "' . $date . '"')
						->groupBy('status')
						->orderBy('status', 'desc');

		if ($incidents->count() === 0 || (int) $incidents->first()->status === 4) {
			$status = 'success';
			$message = 'All systems are functional.';
		} else {
			$status = 'danger';
			$message = 'Some systems are experiencing issues.';
		}

		$view->with([
			'systemStatus' => $status,
			'systemMessage' => $message
		]);
	});

<?php

	View::composer('index', function($view) {
		$date = date('Y-m-d');

		$incidents = Incident::whereRaw('DATE(created_at) = "' . $date . '"')
						->groupBy('status')
						->orderBy('status', 'desc');

		if ($incidents->get()->count() === 1 || (int) $incidents->first()->status === 4) {
			$status = 'success';
			$message = 'All systems are functional.';
		} else {
			$status = 'danger';
			$message = 'Some systems are experiencing issues.';
		}

		$view->with([
			'systemStatus' => $status,
			'systemMessage' => $message
		]);
	});

Fix the view composer, don't poorly check incident statuses
Fix the view composer, don't poorly check incident statuses
