@@ -130,7 +130,7 @@ |
||
130 | 130 | //Check if the active device's image is stale by at least 10 minutes |
131 | 131 | $isImageStale = $device->image()->isStale(); |
132 | 132 | |
133 | - return response()->json([$device, $isImageStale]); |
|
133 | + return response()->json([ $device, $isImageStale ]); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | //Get the first device that doesn't have a null location_id |
36 | 36 | $device = Device::publicDashData()->where('location_id', '!=', 'null')->orderBy('id', 'ASC')->first(); |
37 | 37 | } |
38 | - catch(ModelNotFoundException $e) |
|
38 | + catch (ModelNotFoundException $e) |
|
39 | 39 | { |
40 | 40 | //If no device is found then redirect the user to the home page and display a message about registering a device |
41 | 41 | return redirect('home')->with('no_devices', 'To access the dashboard page there must be at least one registered device assigned to a location.'); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $data = $this->dashData($site, $location, $device); |
50 | 50 | |
51 | - return view('dashboard.index', [ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3] ]); |
|
51 | + return view('dashboard.index', [ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ] ]); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | //Get the first site and if no sites exist throw an error |
93 | 93 | $site = Site::select('id', 'name')->firstOrFail(); |
94 | 94 | } |
95 | - catch(ModelNotFoundException $e) |
|
95 | + catch (ModelNotFoundException $e) |
|
96 | 96 | { |
97 | 97 | //If no device is found then redirect the user to the home page and display a message about registering a device |
98 | 98 | return redirect('home')->with('no_devices', 'To access the dashboard page there must be at least one registered device assigned to a location.'); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | //Check if the active device's image is stale by at least 10 minutes |
122 | 122 | $isImageStale = $device->image()->isStale(); |
123 | 123 | |
124 | - return response()->json([ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3], 'isImageStale' => $isImageStale ]); |
|
124 | + return response()->json([ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ], 'isImageStale' => $isImageStale ]); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | //Check if the active device's image is stale by at least 10 minutes |
145 | 145 | $isImageStale = $device->image()->isStale(); |
146 | 146 | |
147 | - return response()->json([ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3], 'isImageStale' => $isImageStale ]); |
|
147 | + return response()->json([ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ], 'isImageStale' => $isImageStale ]); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | //Check if the active device's image is stale by at least 10 minutes |
168 | 168 | $isImageStale = $device->image()->isStale(); |
169 | 169 | |
170 | - return response()->json([ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3], 'isImageStale' => $isImageStale ]); |
|
170 | + return response()->json([ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ], 'isImageStale' => $isImageStale ]); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | //Get all the devices that belong to the given location ordered by name |
190 | 190 | $devices = $location->devices()->publicDashData()->orderBy('name', 'ASC')->get(); |
191 | 191 | |
192 | - $active_device = collect([$device, $location, $site]); |
|
192 | + $active_device = collect([ $device, $location, $site ]); |
|
193 | 193 | |
194 | - return collect([$active_device, $devices, $locations, $sites]); |
|
194 | + return collect([ $active_device, $devices, $locations, $sites ]); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | return response()->json("Device is currently in use.", 403); |
213 | 213 | |
214 | 214 | //1 = open, 2 = close, 3 = lock |
215 | - switch($request->command) |
|
215 | + switch ($request->command) |
|
216 | 216 | { |
217 | 217 | case 1: |
218 | 218 | $device->cover_command = 'open'; |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | |
249 | 249 | //Check if the current time is during the open schedule or not |
250 | 250 | if (($time_now > $open_time) && ($time_now < $close_time)) |
251 | - $command = 'open'; |
|
251 | + $command = 'open'; |
|
252 | 252 | else |
253 | - $command = 'close'; |
|
253 | + $command = 'close'; |
|
254 | 254 | } |
255 | 255 | else |
256 | - $command = 'lock'; |
|
256 | + $command = 'lock'; |
|
257 | 257 | |
258 | 258 | return $command; |
259 | 259 | } |
@@ -69,10 +69,11 @@ |
||
69 | 69 | //Check if the device has an uploaded image on the server and if it is fresh |
70 | 70 | $staleImage = $query->where('updated_at', '<=', Carbon::now()->subMinute(10))->first(); |
71 | 71 | |
72 | - if (empty($staleImage)) |
|
73 | - $isImageStale = false; |
|
74 | - else |
|
75 | - $isImageStale = true; |
|
72 | + if (empty($staleImage)) { |
|
73 | + $isImageStale = false; |
|
74 | + } else { |
|
75 | + $isImageStale = true; |
|
76 | + } |
|
76 | 77 | |
77 | 78 | return $isImageStale; |
78 | 79 | } |