| @@ 332-349 (lines=18) @@ | ||
| 329 | * @param int $id |
|
| 330 | * @return \Illuminate\Http\RedirectResponse |
|
| 331 | */ |
|
| 332 | public function delete(Request $request, $id) |
|
| 333 | { |
|
| 334 | $repo = new NodeRepository; |
|
| 335 | ||
| 336 | try { |
|
| 337 | $repo->delete($id); |
|
| 338 | Alert::success('Successfully deleted the requested node from the panel.')->flash(); |
|
| 339 | ||
| 340 | return redirect()->route('admin.nodes'); |
|
| 341 | } catch (DisplayException $ex) { |
|
| 342 | Alert::danger($ex->getMessage())->flash(); |
|
| 343 | } catch (\Exception $ex) { |
|
| 344 | Log::error($ex); |
|
| 345 | Alert::danger('An unhandled exception occured while attempting to delete this node. Please try again.')->flash(); |
|
| 346 | } |
|
| 347 | ||
| 348 | return redirect()->route('admin.nodes.view', $id); |
|
| 349 | } |
|
| 350 | ||
| 351 | /** |
|
| 352 | * Returns the configuration token to auto-deploy a node. |
|
| @@ 306-321 (lines=16) @@ | ||
| 303 | * @param int $id |
|
| 304 | * @return \Illuminate\Response\RedirectResponse |
|
| 305 | */ |
|
| 306 | public function toggleInstall(Request $request, $id) |
|
| 307 | { |
|
| 308 | $repo = new ServerRepository; |
|
| 309 | try { |
|
| 310 | $repo->toggleInstall($id); |
|
| 311 | ||
| 312 | Alert::success('Server install status was successfully toggled.')->flash(); |
|
| 313 | } catch (DisplayException $ex) { |
|
| 314 | Alert::danger($ex->getMessage())->flash(); |
|
| 315 | } catch (\Exception $ex) { |
|
| 316 | Log::error($ex); |
|
| 317 | Alert::danger('An unhandled exception occured while attemping to toggle this servers status. This error has been logged.')->flash(); |
|
| 318 | } |
|
| 319 | ||
| 320 | return redirect()->route('admin.servers.view.manage', $id); |
|
| 321 | } |
|
| 322 | ||
| 323 | /** |
|
| 324 | * Setup a server to have a container rebuild. |
|
| @@ 418-433 (lines=16) @@ | ||
| 415 | * @param int $id |
|
| 416 | * @return \Illuminate\Response\RedirectResponse |
|
| 417 | */ |
|
| 418 | public function delete(Request $request, $id) |
|
| 419 | { |
|
| 420 | $repo = new ServerRepository; |
|
| 421 | ||
| 422 | try { |
|
| 423 | $repo->queueDeletion($id, ($request->input('is_force') > 0)); |
|
| 424 | Alert::success('Server has been marked for deletion on the system.')->flash(); |
|
| 425 | } catch (DisplayException $ex) { |
|
| 426 | Alert::danger($ex->getMessage())->flash(); |
|
| 427 | } catch (\Exception $ex) { |
|
| 428 | Log::error($ex); |
|
| 429 | Alert::danger('An unhandled exception occured while attemping to delete this server. This error has been logged.')->flash(); |
|
| 430 | } |
|
| 431 | ||
| 432 | return redirect()->route('admin.servers.view.delete', $id); |
|
| 433 | } |
|
| 434 | ||
| 435 | /** |
|
| 436 | * Cancels a pending server deletion request. |
|
| @@ 73-87 (lines=15) @@ | ||
| 70 | ]); |
|
| 71 | } |
|
| 72 | ||
| 73 | public function deleteUser(Request $request, $id) |
|
| 74 | { |
|
| 75 | try { |
|
| 76 | $repo = new UserRepository; |
|
| 77 | $repo->delete($id); |
|
| 78 | Alert::success('Successfully deleted user from system.')->flash(); |
|
| 79 | ||
| 80 | return redirect()->route('admin.users'); |
|
| 81 | } catch (DisplayException $ex) { |
|
| 82 | Alert::danger($ex->getMessage())->flash(); |
|
| 83 | } catch (\Exception $ex) { |
|
| 84 | Log::error($ex); |
|
| 85 | Alert::danger('An exception was encountered while attempting to delete this user.')->flash(); |
|
| 86 | } |
|
| 87 | ||
| 88 | return redirect()->route('admin.users.view', $id); |
|
| 89 | } |
|
| 90 | ||