mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 21:49:01 +01:00
Introduce an overview of system status
This commit is contained in:
parent
e58f1996f5
commit
16f6f009f6
22
app/view-composers.php
Normal file
22
app/view-composers.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
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) {
|
||||
$status = 'success';
|
||||
$message = 'All systems are functional.';
|
||||
} else {
|
||||
$status = 'error';
|
||||
$message = 'Some systems are experiencing issues.';
|
||||
}
|
||||
|
||||
$view->with([
|
||||
'systemStatus' => $status,
|
||||
'systemMessage' => $message
|
||||
]);
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user