@@ 153-173 (lines=21) @@ | ||
150 | * @param int $id |
|
151 | * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse |
|
152 | */ |
|
153 | public function delete(Request $request, $id) |
|
154 | { |
|
155 | $this->authorize('node-delete', $request->apiKey()); |
|
156 | ||
157 | $repo = new NodeRepository; |
|
158 | try { |
|
159 | $repo->delete($id); |
|
160 | ||
161 | return response('', 204); |
|
162 | } catch (DisplayException $ex) { |
|
163 | return response()->json([ |
|
164 | 'error' => $ex->getMessage(), |
|
165 | ], 400); |
|
166 | } catch (\Exception $ex) { |
|
167 | Log::error($ex); |
|
168 | ||
169 | return response()->json([ |
|
170 | 'error' => 'An unhandled exception occured while attemping to delete this node. Please try again.', |
|
171 | ], 500); |
|
172 | } |
|
173 | } |
|
174 | } |
|
175 |
@@ 252-272 (lines=21) @@ | ||
249 | * @param int $id |
|
250 | * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse |
|
251 | */ |
|
252 | public function install(Request $request, $id) |
|
253 | { |
|
254 | $this->authorize('server-install', $request->apiKey()); |
|
255 | ||
256 | $repo = new ServerRepository; |
|
257 | try { |
|
258 | $repo->toggleInstall($id); |
|
259 | ||
260 | return response('', 204); |
|
261 | } catch (DisplayException $ex) { |
|
262 | return response()->json([ |
|
263 | 'error' => $ex->getMessage(), |
|
264 | ], 400); |
|
265 | } catch (\Exception $ex) { |
|
266 | Log::error($ex); |
|
267 | ||
268 | return response()->json([ |
|
269 | 'error' => 'An unhandled exception occured while attemping to toggle the install status for this server. Please try again.', |
|
270 | ], 500); |
|
271 | } |
|
272 | } |
|
273 | ||
274 | /** |
|
275 | * Setup a server to have a container rebuild. |
@@ 164-184 (lines=21) @@ | ||
161 | * @param int $id |
|
162 | * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse |
|
163 | */ |
|
164 | public function delete(Request $request, $id) |
|
165 | { |
|
166 | $this->authorize('user-delete', $request->apiKey()); |
|
167 | ||
168 | $repo = new UserRepository; |
|
169 | try { |
|
170 | $repo->delete($id); |
|
171 | ||
172 | return response('', 204); |
|
173 | } catch (DisplayException $ex) { |
|
174 | return response()->json([ |
|
175 | 'error' => $ex->getMessage(), |
|
176 | ], 400); |
|
177 | } catch (\Exception $ex) { |
|
178 | Log::error($ex); |
|
179 | ||
180 | return response()->json([ |
|
181 | 'error' => 'An unhandled exception occured while attemping to delete this user. Please try again.', |
|
182 | ], 500); |
|
183 | } |
|
184 | } |
|
185 | } |
|
186 |