Completed
Push — develop ( fbf31c...a8c0b8 )
by Tony
19:53
created
app/Http/Controllers/Alerting/StatsController.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@
 block discarded – undo
25 25
 
26 26
 namespace App\Http\Controllers\Alerting;
27 27
 
28
-use Illuminate\Http\Request;
29
-use App\Models\Alerting\Log;
30 28
 use App\Http\Controllers\Controller;
29
+use App\Models\Alerting\Log;
30
+use Illuminate\Http\Request;
31 31
 
32 32
 class StatsController extends Controller
33 33
 {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
      */
39 39
     public function index(Request $request)
40 40
     {
41
-        $data = Log::join('alert_rules', 'alert_rules.id', '=', 'alert_log.rule_id')->where('state', '!=', '0')->groupBy('time_logged')->groupBy('alert_rules.severity')->select('time_logged','alert_rules.severity',\DB::raw('COUNT(alert_log.id) as total'))->get();
41
+        $data = Log::join('alert_rules', 'alert_rules.id', '=', 'alert_log.rule_id')->where('state', '!=', '0')->groupBy('time_logged')->groupBy('alert_rules.severity')->select('time_logged', 'alert_rules.severity', \DB::raw('COUNT(alert_log.id) as total'))->get();
42 42
         $output = array();
43 43
         foreach ($data as $log) {
44 44
             $output[$log->severity]['label'] = $log->severity;
Please login to merge, or discard this patch.
app/Models/Alerting/Log.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
     public function getTimeLoggedAttribute($date)
97 97
     {
98 98
         if ($date) {
99
-            return strtotime($date)*1000;
99
+            return strtotime($date) * 1000;
100 100
         }
101 101
     }
102 102
 }
Please login to merge, or discard this patch.
app/DataTables/Alerting/LogsDataTable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 return '<b><span class="fa fa-'.$icon.'" style="color:'.$colour.'"></span> '.$text.'</b>';
83 83
             })
84 84
             ->editColumn('time_logged', function($this) {
85
-                return date('Y-m-d H:i:s', $this['time_logged']/1000);
85
+                return date('Y-m-d H:i:s', $this['time_logged'] / 1000);
86 86
             })
87 87
             ->make(true);
88 88
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function query()
96 96
     {
97
-        $logs = Log::query()->with('device','user','rule')->select('alert_log.*');
97
+        $logs = Log::query()->with('device', 'user', 'rule')->select('alert_log.*');
98 98
         return $this->applyScopes($logs);
99 99
     }
100 100
 
Please login to merge, or discard this patch.