Completed
Pull Request — master (#87)
by Brandon
02:20
created
app/Http/Controllers/DeviceController.php 1 patch
Braces   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -84,8 +84,7 @@  discard block
 block discarded – undo
84 84
             $sites->prepend($location->site);
85 85
             //Add the current location to the front of the collection of locations
86 86
             $locations->prepend($location);
87
-        }
88
-        else
87
+        } else
89 88
         {
90 89
             //Set locations to null since there is no site or location attached to the selected device
91 90
             $locations = null;
@@ -93,10 +92,11 @@  discard block
 block discarded – undo
93 92
             $sites = Site::all();
94 93
         }
95 94
         
96
-        if (\Request::ajax())
97
-            return response()->json([ 'device' => $device, 'locations' => $locations, 'sites' => $sites ]);
98
-        else
99
-            return view('device.edit', [ 'device' => $device, 'locations' => $locations, 'sites' => $sites ]);
95
+        if (\Request::ajax()) {
96
+                    return response()->json([ 'device' => $device, 'locations' => $locations, 'sites' => $sites ]);
97
+        } else {
98
+                    return view('device.edit', [ 'device' => $device, 'locations' => $locations, 'sites' => $sites ]);
99
+        }
100 100
     }
101 101
     
102 102
     /**
@@ -110,8 +110,9 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $locations = Location::bySite($site_id)->select('id', 'name', 'site_id')->get();
112 112
         
113
-        if ($locations->isEmpty())
114
-            $locations = null;
113
+        if ($locations->isEmpty()) {
114
+                    $locations = null;
115
+        }
115 116
     
116 117
         return response()->json($locations);
117 118
     }
@@ -151,8 +152,7 @@  discard block
 block discarded – undo
151 152
             //Create a new site
152 153
             $siteName = $request->input('new_site_name');
153 154
             $site_id = Site::createSite($siteName)->id;
154
-        }
155
-        else
155
+        } else
156 156
         {
157 157
             $site_id = $request->input('site');
158 158
         }
@@ -166,8 +166,7 @@  discard block
 block discarded – undo
166 166
             //Create a new location
167 167
             $locationName = $request->input('new_location_name');
168 168
             $location_id = Location::createLocation($locationName, $site_id)->id;
169
-        }
170
-        else
169
+        } else
171 170
         {
172 171
             $location_id = $request->input('location');
173 172
         }
@@ -188,10 +187,11 @@  discard block
 block discarded – undo
188 187
         //Remove any unused sites or locations
189 188
         $this->RemoveUnusedSiteLoc();
190 189
     
191
-        if (\Request::ajax())
192
-            return response()->json("Success");
193
-        else
194
-            return redirect('device');
190
+        if (\Request::ajax()) {
191
+                    return response()->json("Success");
192
+        } else {
193
+                    return redirect('device');
194
+        }
195 195
     }
196 196
 
197 197
     /**
Please login to merge, or discard this patch.