@@ 303-322 (lines=20) @@ | ||
300 | * @param int $id |
|
301 | * @return \Illuminate\Http\RedirectResponse |
|
302 | */ |
|
303 | public function setContainer(Request $request, $id) |
|
304 | { |
|
305 | $repo = new ServerRepository; |
|
306 | ||
307 | try { |
|
308 | $repo->updateContainer($id, $request->intersect('docker_image')); |
|
309 | ||
310 | Alert::success('Successfully updated this server\'s docker image.')->flash(); |
|
311 | } catch (DisplayValidationException $ex) { |
|
312 | return redirect()->route('admin.servers.view.details', $id)->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
313 | } catch (TransferException $ex) { |
|
314 | Log::warning($ex); |
|
315 | Alert::danger('A TransferException occured while attempting to update the container image. Is the daemon online? This error has been logged.'); |
|
316 | } catch (\Exception $ex) { |
|
317 | Log::error($ex); |
|
318 | Alert::danger('An unhandled exception occured while attemping to update this server\'s docker image. This error has been logged.')->flash(); |
|
319 | } |
|
320 | ||
321 | return redirect()->route('admin.servers.view.details', $id); |
|
322 | } |
|
323 | ||
324 | /** |
|
325 | * Toggles the install status for a server. |
|
@@ 471-491 (lines=21) @@ | ||
468 | * @param int $id |
|
469 | * @return \Illuminate\Http\RedirectResponse |
|
470 | */ |
|
471 | public function delete(Request $request, $id) |
|
472 | { |
|
473 | $repo = new ServerRepository; |
|
474 | ||
475 | try { |
|
476 | $repo->delete($id, $request->has('force_delete')); |
|
477 | Alert::success('Server was successfully deleted from the system.')->flash(); |
|
478 | ||
479 | return redirect()->route('admin.servers'); |
|
480 | } catch (DisplayException $ex) { |
|
481 | Alert::danger($ex->getMessage())->flash(); |
|
482 | } catch (TransferException $ex) { |
|
483 | Log::warning($ex); |
|
484 | Alert::danger('A TransferException occurred while attempting to delete this server from the daemon, please ensure it is running. This error has been logged.')->flash(); |
|
485 | } catch (\Exception $ex) { |
|
486 | Log::error($ex); |
|
487 | Alert::danger('An unhandled exception occured while attemping to delete this server. This error has been logged.')->flash(); |
|
488 | } |
|
489 | ||
490 | return redirect()->route('admin.servers.view.delete', $id); |
|
491 | } |
|
492 | ||
493 | /** |
|
494 | * Update the startup command as well as variables. |