@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * Store a newly created resource in storage. |
45 | 45 | * |
46 | 46 | * @param Request $request |
47 | - * @return Response |
|
47 | + * @return \Illuminate\Http\RedirectResponse |
|
48 | 48 | */ |
49 | 49 | public function store(Request $request) |
50 | 50 | { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @param Request $request |
97 | 97 | * @param int $id |
98 | - * @return Response |
|
98 | + * @return \Illuminate\Http\RedirectResponse |
|
99 | 99 | */ |
100 | 100 | public function update(Request $request, $id) |
101 | 101 | { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * Remove the specified resource from storage. |
114 | 114 | * |
115 | 115 | * @param int $id |
116 | - * @return Response |
|
116 | + * @return \Illuminate\Http\RedirectResponse |
|
117 | 117 | */ |
118 | 118 | public function destroy($id) |
119 | 119 | { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | return redirect()->route('user.index') |
157 | - ->with('success','User deleted successfully'); |
|
157 | + ->with('success', 'User deleted successfully'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -170,6 +170,6 @@ discard block |
||
170 | 170 | $user->restore(); |
171 | 171 | |
172 | 172 | return redirect()->route('user.show', $user->id) |
173 | - ->with('success','User restored successfully'); |
|
173 | + ->with('success', 'User restored successfully'); |
|
174 | 174 | } |
175 | 175 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | return redirect()->route('device.index') |
216 | - ->with('success','Device deleted successfully'); |
|
216 | + ->with('success', 'Device deleted successfully'); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -229,6 +229,6 @@ discard block |
||
229 | 229 | $device->restore(); |
230 | 230 | |
231 | 231 | return redirect()->route('device.show', $device->id) |
232 | - ->with('success','Device restored successfully'); |
|
232 | + ->with('success', 'Device restored successfully'); |
|
233 | 233 | } |
234 | 234 | } |
@@ -84,8 +84,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | /** |