| @@ 187-205 (lines=19) @@ | ||
| 184 | ]); |
|
| 185 | } |
|
| 186 | ||
| 187 | public function postUpload(Request $request) |
|
| 188 | { |
|
| 189 | try { |
|
| 190 | $repo = new Pack; |
|
| 191 | $pack = $repo->createWithTemplate($request->only(['option', 'file_upload'])); |
|
| 192 | Alert::success('Successfully created new service!')->flash(); |
|
| 193 | ||
| 194 | return redirect()->route('admin.services.packs.edit', $pack->id)->withInput(); |
|
| 195 | } catch (DisplayValidationException $ex) { |
|
| 196 | return redirect()->back()->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 197 | } catch (DisplayException $ex) { |
|
| 198 | Alert::danger($ex->getMessage())->flash(); |
|
| 199 | } catch (\Exception $ex) { |
|
| 200 | Log::error($ex); |
|
| 201 | Alert::danger('An error occured while attempting to add a new service pack.')->flash(); |
|
| 202 | } |
|
| 203 | ||
| 204 | return redirect()->back(); |
|
| 205 | } |
|
| 206 | } |
|
| 207 | ||
| @@ 85-104 (lines=20) @@ | ||
| 82 | ]); |
|
| 83 | } |
|
| 84 | ||
| 85 | public function postNewServer(Request $request) |
|
| 86 | { |
|
| 87 | try { |
|
| 88 | $server = new ServerRepository; |
|
| 89 | $response = $server->create($request->except('_token')); |
|
| 90 | ||
| 91 | return redirect()->route('admin.servers.view', ['id' => $response->id]); |
|
| 92 | } catch (DisplayValidationException $ex) { |
|
| 93 | return redirect()->route('admin.servers.new')->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 94 | } catch (DisplayException $ex) { |
|
| 95 | Alert::danger($ex->getMessage())->flash(); |
|
| 96 | ||
| 97 | return redirect()->route('admin.servers.new')->withInput(); |
|
| 98 | } catch (\Exception $ex) { |
|
| 99 | Log::error($ex); |
|
| 100 | Alert::danger('An unhandled exception occured while attemping to add this server. Please try again.')->flash(); |
|
| 101 | ||
| 102 | return redirect()->route('admin.servers.new')->withInput(); |
|
| 103 | } |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * Returns a JSON tree of all avaliable nodes in a given location. |
|