Completed
Push — master ( b51238...70c289 )
by Brandon
18s
created
app/Http/Controllers/ImageController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         if (Storage::disk('private')->exists('deviceimage/'.$device_id)) {
31 31
             $image = Image::make(Storage::disk('private')->get('deviceimage/'.$device_id));
32 32
         } else {
33
-            $image = Image::make(public_path() . '/img/video_not_found.jpg');
33
+            $image = Image::make(public_path().'/img/video_not_found.jpg');
34 34
         }
35 35
         
36 36
         return $image->response();
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function store($device_id, $binaryData)
47 47
     {
48
-        $storagePath = storage_path('app/private/deviceimage/') . $device_id;
48
+        $storagePath = storage_path('app/private/deviceimage/').$device_id;
49 49
         $image = Image::make($binaryData);
50 50
         $image->save($storagePath, 75);
51 51
     }
Please login to merge, or discard this patch.
app/Http/Controllers/ApiController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
      */    
19 19
     public function index()
20 20
     {
21
-        return response()->json(['data' => 'SmartSettia API - Bad request type.'], 400);
21
+        return response()->json([ 'data' => 'SmartSettia API - Bad request type.' ], 400);
22 22
     }
23 23
 
24 24
     /**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         
63 63
         // If validation fails, send the validation error back with status 400.
64 64
         if ($validator->fails()) {
65
-            return response()->json(['data' => $validator->errors()], 400);
65
+            return response()->json([ 'data' => $validator->errors() ], 400);
66 66
         }
67 67
         
68 68
         // Get the device record.
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         
71 71
         // If token doesnt match then send 401 unauthorized.
72 72
         if ($request->input('token') != $device->token) {
73
-            return response()->json(['data' => 'Bad token.'], 401);
73
+            return response()->json([ 'data' => 'Bad token.' ], 401);
74 74
         }
75 75
         
76 76
         // Update the device.
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         //event(new Registered(true));
101 101
         
102 102
         // Return the new device info including the token.
103
-        return response()->json(['data' => $device->toArray()], 201);
103
+        return response()->json([ 'data' => $device->toArray() ], 201);
104 104
     }
105 105
     
106 106
     /**
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
         
120 120
         // If validation fails, send the validation error back with status 400.
121 121
         if ($validator->fails()) {
122
-            return response()->json(['data' => $validator->errors()], 400);
122
+            return response()->json([ 'data' => $validator->errors() ], 400);
123 123
         }
124 124
         
125 125
         // If challenge string doesnt match then send 401 unauthorized.
126 126
         if ($request->input('challenge') != env('API_CHALLENGE', 'temppass')) {
127
-            return response()->json(['data' => 'Bad challenge.'], 401);
127
+            return response()->json([ 'data' => 'Bad challenge.' ], 401);
128 128
         }
129 129
         
130 130
         // If the uuid already exists then just send them the record.
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                 'uuid' => $device->uuid,
135 135
                 'id' => $device->id,
136 136
                 'token' => $device->token,
137
-            ]], 200);
137
+            ] ], 200);
138 138
         }
139 139
         
140 140
         // Create the new device.
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             'uuid' => $device->uuid,
158 158
             'id' => $device->id,
159 159
             'token' => $device->token,
160
-        ]], 201);
160
+        ] ], 201);
161 161
     }
162 162
     
163 163
     /**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         
177 177
         // If validation fails, send the validation error back with status 400.
178 178
         if ($validator->fails()) {
179
-            return response()->json(['data' => $validator->errors()], 400);
179
+            return response()->json([ 'data' => $validator->errors() ], 400);
180 180
         }
181 181
         
182 182
         // Get the device record.
@@ -184,25 +184,25 @@  discard block
 block discarded – undo
184 184
         
185 185
         // If token doesnt match then send 401 unauthorized.
186 186
         if ($request->input('token') != $device->token) {
187
-            return response()->json(['data' => 'Bad token.'], 401);
187
+            return response()->json([ 'data' => 'Bad token.' ], 401);
188 188
         }
189 189
         
190 190
         // Save the image to disk.
191
-        $path = $request->file('image')->storeAs('deviceimage', $device['id'], 'private');
191
+        $path = $request->file('image')->storeAs('deviceimage', $device[ 'id' ], 'private');
192 192
         
193 193
         // Update the url for the image.
194 194
         $deviceimage = Deviceimage::updateOrCreate(
195
-            ['device_id' => $device['id']],
196
-            ['url' => $path]
195
+            [ 'device_id' => $device[ 'id' ] ],
196
+            [ 'url' => $path ]
197 197
         );
198 198
         
199 199
         // Force the updated_at timestamp to update as the url may not change.
200 200
         $deviceimage->touch();
201 201
         
202 202
         return response()->json([ 'data' => [ 
203
-            'id' => $deviceimage['id'],
203
+            'id' => $deviceimage[ 'id' ],
204 204
             'url' => $path,
205
-        ]], 201);
205
+        ] ], 201);
206 206
     }
207 207
 }
208 208
 
Please login to merge, or discard this patch.
app/DataTables/DevicesDataTable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         return $this->datatables
19 19
             ->eloquent($this->query())
20 20
             ->addColumn('action', 'device.action')
21
-            ->blacklist([ 'action'])
21
+            ->blacklist([ 'action' ])
22 22
             ->setRowClass(function($device) {
23 23
                 return $device->trashed() ? 'alert-danger' : "";
24 24
             });
Please login to merge, or discard this patch.
app/Device.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @var array
27 27
      */
28
-    protected $hidden = ['token'];
28
+    protected $hidden = [ 'token' ];
29 29
     
30 30
     /**
31 31
      * The attributes that are mass assignable.
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         $time = new Carbon($value, Auth::user()->timezone);
100 100
         $time = $time->setTimezone('UTC');
101
-        $this->attributes['open_time'] = $time;
101
+        $this->attributes[ 'open_time' ] = $time;
102 102
     }
103 103
     
104 104
     /**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $time = new Carbon($value, Auth::user()->timezone);
113 113
         $time = $time->setTimezone('UTC');
114
-        $this->attributes['close_time'] = $time;
114
+        $this->attributes[ 'close_time' ] = $time;
115 115
     }
116 116
     
117 117
     /**
Please login to merge, or discard this patch.
app/Http/Controllers/DashboardController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     
39 39
         $data = $this->dashData($site, $location, $device);
40 40
         
41
-        return view('dashboard.index', [ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3] ]);
41
+        return view('dashboard.index', [ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ] ]);
42 42
     }
43 43
     
44 44
     /**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         
100 100
         $data = $this->dashData($site, $location, $device);
101 101
         
102
-        return response()->json([ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3] ]);
102
+        return response()->json([ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ] ]);
103 103
     }
104 104
     
105 105
     /**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         
120 120
         $data = $this->dashData($site, $location, $device);
121 121
         
122
-        return response()->json([ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3] ]);
122
+        return response()->json([ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ] ]);
123 123
     }
124 124
     
125 125
     /**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         
140 140
         $data = $this->dashData($site, $location, $device);
141 141
         
142
-        return response()->json([ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3] ]);
142
+        return response()->json([ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ] ]);
143 143
     }
144 144
     
145 145
     /**
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
         //Get all the devices that belong to the given location ordered by name
162 162
         $devices = $location->devices()->publicDashData()->orderBy('name', 'ASC')->get();
163 163
         
164
-        $active_device = collect([$device, $location, $site]);
164
+        $active_device = collect([ $device, $location, $site ]);
165 165
         
166
-        return collect([$active_device, $devices, $locations, $sites]);
166
+        return collect([ $active_device, $devices, $locations, $sites ]);
167 167
     }
168 168
     
169 169
     /**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             return response()->json("Device is currently in use.", 403);
185 185
         
186 186
         //1 = open, 2 = close, 3 = lock
187
-        switch($request->command)
187
+        switch ($request->command)
188 188
         {
189 189
             case 1:
190 190
                 $device->cover_command = 'open';
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
             
221 221
             //Check if the current time is during the open schedule or not
222 222
             if (($time_now > $open_time) && ($time_now < $close_time))
223
-                $command =  'open';
223
+                $command = 'open';
224 224
             else
225
-                $command =  'close';
225
+                $command = 'close';
226 226
         }
227 227
         else
228
-            $command =  'lock';
228
+            $command = 'lock';
229 229
         
230 230
         return $command;
231 231
     }
Please login to merge, or discard this patch.