Completed
Pull Request — master (#94)
by Brandon
08:56
created
app/Http/Controllers/SensorController.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 use App\Sensor;
6 6
 use App\DataTables\SensorDataTable;
7 7
 use Illuminate\Http\Request;
8
-use Validator;
9 8
 use Charts;
10 9
 
11 10
 class SensorController extends Controller 
Please login to merge, or discard this patch.
app/Sensor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
      */
70 70
     public function getLatestDataAttribute()
71 71
     {
72
-        return $this->hasOne('App\SensorData')->latest()->first() ?? (object)[];
72
+        return $this->hasOne('App\SensorData')->latest()->first() ?? (object) [ ];
73 73
     }
74 74
     
75 75
     /**
Please login to merge, or discard this patch.
app/Http/Controllers/DeviceController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $device = Device::findOrFail($id);
57 57
         
58
-        $charts = [];
58
+        $charts = [ ];
59 59
         foreach ($device->sensors as $sensor) {
60
-            $charts[$sensor->id] = Charts::create('line', 'highcharts')
60
+            $charts[ $sensor->id ] = Charts::create('line', 'highcharts')
61 61
                 ->title($sensor->name)
62 62
                 ->elementLabel($sensor->type)
63 63
                 ->labels($sensor->last_week_daily_avg_data->pluck('date'))
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         $sites = Site::select('id', 'name')->orderByRaw("id = ? DESC", $site_id)
90 90
             ->orderBy('name', 'ASC')->get();
91 91
         //Get all locations for the selected site with the selected location first
92
-        $locations = Location::select('id', 'name')->where('site_id', '=', $sites[0]->id ?? 0)
92
+        $locations = Location::select('id', 'name')->where('site_id', '=', $sites[ 0 ]->id ?? 0)
93 93
             ->orderByRaw("id = ? DESC", $location_id)->orderBy('name', 'ASC')->get();
94 94
         
95 95
         return view('device.edit', [ 'device' => $device, 'locations' => $locations, 'sites' => $sites ]);
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         if (!empty($request->input('new_site_name')))
111 111
         {
112 112
             //Create a new site
113
-            $site = Site::create(['name' => $request->input('new_site_name')]);
113
+            $site = Site::create([ 'name' => $request->input('new_site_name') ]);
114 114
             $site_id = $site->id;
115 115
         }
116 116
         else
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         if (!empty($request->input('new_location_name')))
121 121
         {
122 122
             //Create a new location
123
-            $location = Location::create(['name' => $request->input('new_location_name'), 'site_id' => $site_id]);
123
+            $location = Location::create([ 'name' => $request->input('new_location_name'), 'site_id' => $site_id ]);
124 124
             $location_id = $location->id;
125 125
         }
126 126
         else
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
             if ($request->command === 'unlock')
148 148
             {
149 149
                 if ($device->isDuringScheduleOpen())
150
-                    $command =  'open';
150
+                    $command = 'open';
151 151
                 else
152
-                    $command =  'close';
152
+                    $command = 'close';
153 153
             }
154 154
             $device->cover_command = $command;
155 155
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         $device->save();
158 158
     
159 159
         if (\Request::ajax())
160
-            return response()->json(['success' => 'Device updated successfully']);
160
+            return response()->json([ 'success' => 'Device updated successfully' ]);
161 161
         else
162 162
             return redirect()->route('device.show', $id)
163 163
                 ->with('success', 'Device updated successfully');
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         }
190 190
 
191 191
         return redirect()->route('device.index')
192
-            ->with('success','Device deleted successfully');
192
+            ->with('success', 'Device deleted successfully');
193 193
     }
194 194
     
195 195
     /**
@@ -205,6 +205,6 @@  discard block
 block discarded – undo
205 205
         $device->restore();
206 206
         
207 207
         return redirect()->route('device.show', $device->id)
208
-            ->with('success','Device restored successfully');
208
+            ->with('success', 'Device restored successfully');
209 209
     }
210 210
 }
Please login to merge, or discard this patch.