Completed
Push — master ( 50d630...c90189 )
by Brandon
20s
created
app/Http/Controllers/DeviceController.php 1 patch
Braces   +15 added lines, -18 removed lines patch added patch discarded remove patch
@@ -80,8 +80,7 @@  discard block
 block discarded – undo
80 80
         {
81 81
             $sites = $this->site_m->orderedSitesBy($location->site_id);
82 82
             $locations = $this->location_m->orderedSiteLocationsBy($location->site_id, $device->location_id);
83
-        }
84
-        else
83
+        } else
85 84
         {
86 85
             $locations = null;
87 86
             $sites = $this->site_m->all();
@@ -178,10 +177,11 @@  discard block
 block discarded – undo
178 177
         ]);
179 178
         
180 179
         if ($validator->fails()) {
181
-            if ($request->input('from') == 'modal')
182
-                return response()->json(['errors'=>$validator->errors()], 422);
183
-            else
184
-                return redirect('device/'.$id.'/edit')->withErrors($validator)->withInput();
180
+            if ($request->input('from') == 'modal') {
181
+                            return response()->json(['errors'=>$validator->errors()], 422);
182
+            } else {
183
+                            return redirect('device/'.$id.'/edit')->withErrors($validator)->withInput();
184
+            }
185 185
         }
186 186
         
187 187
         $siteNew = !empty($request->input('new_site_name'));
@@ -191,8 +191,7 @@  discard block
 block discarded – undo
191 191
             //Create a new site
192 192
             $siteName = $request->input('new_site_name');
193 193
             $site_id = $this->site_m->createSite($siteName);
194
-        }
195
-        else
194
+        } else
196 195
         {
197 196
             $site_id = $request->input('site');
198 197
         }
@@ -204,8 +203,7 @@  discard block
 block discarded – undo
204 203
             //Create a new location
205 204
             $locationName = $request->input('new_location_name');
206 205
             $location_id = $this->location_m->createLocation($locationName, $site_id);
207
-        }
208
-        else
206
+        } else
209 207
         {
210 208
             $location_id = $request->input('location');
211 209
         }
@@ -220,10 +218,11 @@  discard block
 block discarded – undo
220 218
         //If the old site isn't connected to a device then remove it
221 219
         $this->removeUnusedSite($oldLocationID);
222 220
         
223
-        if ($request->input('from') == 'modal')
224
-            return "Success";
225
-        else
226
-            return redirect('device');
221
+        if ($request->input('from') == 'modal') {
222
+                    return "Success";
223
+        } else {
224
+                    return redirect('device');
225
+        }
227 226
     }
228 227
 
229 228
     /**
@@ -240,8 +239,7 @@  discard block
 block discarded – undo
240 239
         {
241 240
             //If the user was already deleted then permanently delete it
242 241
             $this->device_m->destroy($id);
243
-        }
244
-        else
242
+        } else
245 243
         {
246 244
             //Remove the location from the device
247 245
             $oldLocation_id = $device->location_id;
@@ -287,8 +285,7 @@  discard block
 block discarded – undo
287 285
             {
288 286
                 //Get the site connected to the location and delete it
289 287
                 $this->site_m->findOrFail($site_id)->delete();
290
-            }
291
-            else
288
+            } else
292 289
             {
293 290
                 //Delete the location that isn't used anymore
294 291
                 $oldLocation->delete();
Please login to merge, or discard this patch.