Completed
Push — device-groups ( 54870b...cccab4 )
by Tony
03:45
created
app/Http/Controllers/Widgets/WidgetDataController.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,7 +82,8 @@  discard block
 block discarded – undo
82 82
         $uptime = Settings::get('uptime_warning', 84600);
83 83
         if ($request->user()->hasGlobalRead()) {
84 84
             $devices = Device::where('ignore', '=', 0)->get();
85
-        } else {
85
+        }
86
+        else {
86 87
             $devices = User::find($request->user()->user_id)->devices()->where('ignore', '=', 0)->get();
87 88
         }
88 89
         $count = ['warn' => 0, 'up' => 0, 'down' => 0];
@@ -90,10 +91,12 @@  discard block
 block discarded – undo
90 91
             if ($device->status == 1) {
91 92
                 if (($device->uptime < $uptime) && ($device->uptime != '0')) {
92 93
                     $count['warn']++;
93
-                } else {
94
+                }
95
+                else {
94 96
                     $count['up']++;
95 97
                 }
96
-            } else {
98
+            }
99
+            else {
97 100
                 $count['down']++;
98 101
             }
99 102
         }
@@ -122,7 +125,8 @@  discard block
 block discarded – undo
122 125
             $count['ports']['down'] = Port::isDown()->count();
123 126
             $count['ports']['ignored'] = Port::isIgnored()->count();
124 127
             $count['ports']['disabled'] = Port::isDisabled()->count();
125
-        } else {
128
+        }
129
+        else {
126 130
             $user = User::find($request->user()->user_id);
127 131
 
128 132
             $count['devices']['total'] = $user->devices()->count();
Please login to merge, or discard this patch.
app/Api/Controllers/DashboardWidgetController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      */
74 74
     public function show(Request $request, $id)
75 75
     {
76
-        $widget  = Widgets::find($id);
76
+        $widget = Widgets::find($id);
77 77
         return array('widget' => $widget);
78 78
     }
79 79
 
Please login to merge, or discard this patch.
app/DataTables/DeviceDataTable.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,6 @@
 block discarded – undo
25 25
 
26 26
 namespace App\DataTables;
27 27
 
28
-use App\Models\DeviceGroup;
29 28
 use App\Models\Device;
30 29
 
31 30
 class DeviceDataTable extends BaseDataTable
Please login to merge, or discard this patch.
app/DataTables/Scopes/DeviceGroup.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -9,6 +9,9 @@
 block discarded – undo
9 9
     private $group_id;
10 10
 
11 11
 
12
+    /**
13
+     * @param integer $group_id
14
+     */
12 15
     function __construct($group_id) {
13 16
         $this->group_id = $group_id;
14 17
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function apply($query)
23 23
     {
24
-        return $query->whereHas('groups', function ($q) {
24
+        return $query->whereHas('groups', function($q) {
25 25
             $q->where('id', '=', $this->group_id);
26 26
         });
27 27
     }
Please login to merge, or discard this patch.
app/Http/Controllers/DeviceController.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace App\Http\Controllers;
4 4
 
5 5
 use App\DataTables\DeviceDataTable;
6
-use App\DataTables\DeviceGroupDataTable;
7 6
 use App\Models\DeviceGroup;
8 7
 use Dingo\Api\Http;
9 8
 use Dingo\Api\Routing\Helpers;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
      *
19 19
      * @return \Illuminate\Http\JsonResponse|\Illuminate\View\View
20 20
      */
21
-    public function index(DeviceDataTable $dataTable, $group_id=-1)
21
+    public function index(DeviceDataTable $dataTable, $group_id = -1)
22 22
     {
23 23
         $group_name = "";
24
-        if($group_id >= 0) {
24
+        if ($group_id >= 0) {
25 25
             $dataTable->addScope(new \App\DataTables\Scopes\DeviceGroup($group_id));
26 26
             $group_name = DeviceGroup::find($group_id)->name;
27 27
         }
Please login to merge, or discard this patch.