| @@ 388-409 (lines=22) @@ | ||
| 385 | * @param int $id |
|
| 386 | * @return \Illuminate\Response\RedirectResponse |
|
| 387 | */ |
|
| 388 | public function updateBuild(Request $request, $id) |
|
| 389 | { |
|
| 390 | $repo = new ServerRepository; |
|
| 391 | ||
| 392 | try { |
|
| 393 | $repo->changeBuild($id, $request->intersect([ |
|
| 394 | 'allocation_id', 'add_allocations', 'remove_allocations', |
|
| 395 | 'memory', 'swap', 'io', 'cpu', |
|
| 396 | ])); |
|
| 397 | ||
| 398 | Alert::success('Server details were successfully updated.')->flash(); |
|
| 399 | } catch (DisplayValidationException $ex) { |
|
| 400 | return redirect()->route('admin.servers.view.build', $id)->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 401 | } catch (DisplayException $ex) { |
|
| 402 | Alert::danger($ex->getMessage())->flash(); |
|
| 403 | } catch (\Exception $ex) { |
|
| 404 | Log::error($ex); |
|
| 405 | Alert::danger('An unhandled exception occured while attemping to add this server. This error has been logged.')->flash(); |
|
| 406 | } |
|
| 407 | ||
| 408 | return redirect()->route('admin.servers.view.build', $id); |
|
| 409 | } |
|
| 410 | ||
| 411 | /** |
|
| 412 | * Start the server deletion process. |
|
| @@ 86-105 (lines=20) @@ | ||
| 83 | ]); |
|
| 84 | } |
|
| 85 | ||
| 86 | public function postService(Request $request, $service) |
|
| 87 | { |
|
| 88 | try { |
|
| 89 | $repo = new ServiceRepository\Service; |
|
| 90 | $repo->update($service, $request->only([ |
|
| 91 | 'name', 'description', 'file', |
|
| 92 | 'executable', 'startup', |
|
| 93 | ])); |
|
| 94 | Alert::success('Successfully updated this service.')->flash(); |
|
| 95 | } catch (DisplayValidationException $ex) { |
|
| 96 | return redirect()->route('admin.services.service', $service)->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 97 | } catch (DisplayException $ex) { |
|
| 98 | Alert::danger($ex->getMessage())->flash(); |
|
| 99 | } catch (\Exception $ex) { |
|
| 100 | Log::error($ex); |
|
| 101 | Alert::danger('An error occurred while attempting to update this service.')->flash(); |
|
| 102 | } |
|
| 103 | ||
| 104 | return redirect()->route('admin.services.service', $service)->withInput(); |
|
| 105 | } |
|
| 106 | ||
| 107 | public function deleteService(Request $request, $service) |
|
| 108 | { |
|