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