| @@ 165-183 (lines=19) @@ | ||
| 162 | ]); |
|
| 163 | } |
|
| 164 | ||
| 165 | public function postNewServer(Request $request) |
|
| 166 | { |
|
| 167 | try { |
|
| 168 | $server = new ServerRepository; |
|
| 169 | $response = $server->create($request->all()); |
|
| 170 | ||
| 171 | return redirect()->route('admin.servers.view', ['id' => $response]); |
|
| 172 | } catch (DisplayValidationException $ex) { |
|
| 173 | return redirect()->route('admin.servers.new')->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 174 | } catch (DisplayException $ex) { |
|
| 175 | Alert::danger($ex->getMessage())->flash(); |
|
| 176 | ||
| 177 | return redirect()->route('admin.servers.new')->withInput(); |
|
| 178 | } catch (\Exception $ex) { |
|
| 179 | Log::error($ex); |
|
| 180 | Alert::danger('An unhandled exception occured while attemping to add this server. Please try again.')->flash(); |
|
| 181 | ||
| 182 | return redirect()->route('admin.servers.new')->withInput(); |
|
| 183 | } |
|
| 184 | } |
|
| 185 | ||
| 186 | /** |
|
| @@ 56-72 (lines=17) @@ | ||
| 53 | return view('base.api.new'); |
|
| 54 | } |
|
| 55 | ||
| 56 | public function save(Request $request) |
|
| 57 | { |
|
| 58 | try { |
|
| 59 | $repo = new APIRepository($request->user()); |
|
| 60 | $secret = $repo->create($request->except(['_token'])); |
|
| 61 | Alert::success('An API Keypair has successfully been generated. The API secret for this public key is shown below and will not be shown again.<br /><br /><code>' . $secret . '</code>')->flash(); |
|
| 62 | ||
| 63 | return redirect()->route('account.api'); |
|
| 64 | } catch (DisplayValidationException $ex) { |
|
| 65 | return redirect()->route('account.api.new')->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 66 | } catch (DisplayException $ex) { |
|
| 67 | Alert::danger($ex->getMessage())->flash(); |
|
| 68 | } catch (\Exception $ex) { |
|
| 69 | Log::error($ex); |
|
| 70 | Alert::danger('An unhandled exception occured while attempting to add this API key.')->flash(); |
|
| 71 | } |
|
| 72 | ||
| 73 | return redirect()->route('account.api.new')->withInput(); |
|
| 74 | } |
|
| 75 | ||
| @@ 96-114 (lines=19) @@ | ||
| 93 | } |
|
| 94 | } |
|
| 95 | ||
| 96 | public function postLocation(Request $request) |
|
| 97 | { |
|
| 98 | try { |
|
| 99 | $location = new LocationRepository; |
|
| 100 | $id = $location->create($request->only(['long', 'short'])); |
|
| 101 | Alert::success('New location successfully added.')->flash(); |
|
| 102 | ||
| 103 | return redirect()->route('admin.locations'); |
|
| 104 | } catch (DisplayValidationException $ex) { |
|
| 105 | return redirect()->route('admin.locations')->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 106 | } catch (DisplayException $ex) { |
|
| 107 | Alert::danger($ex->getMessage())->flash(); |
|
| 108 | } catch (\Exception $ex) { |
|
| 109 | Log::error($ex); |
|
| 110 | Alert::danger('An unhandled exception occured while attempting to add this location. Please try again.')->flash(); |
|
| 111 | } |
|
| 112 | ||
| 113 | return redirect()->route('admin.locations')->withInput(); |
|
| 114 | } |
|
| 115 | } |
|
| 116 | ||
| @@ 195-213 (lines=19) @@ | ||
| 192 | ]); |
|
| 193 | } |
|
| 194 | ||
| 195 | public function postUpload(Request $request) |
|
| 196 | { |
|
| 197 | try { |
|
| 198 | $repo = new Pack; |
|
| 199 | $pack = $repo->createWithTemplate($request->only(['option', 'file_upload'])); |
|
| 200 | Alert::success('Successfully created new service!')->flash(); |
|
| 201 | ||
| 202 | return redirect()->route('admin.services.packs.edit', $pack->id)->withInput(); |
|
| 203 | } catch (DisplayValidationException $ex) { |
|
| 204 | return redirect()->back()->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 205 | } catch (DisplayException $ex) { |
|
| 206 | Alert::danger($ex->getMessage())->flash(); |
|
| 207 | } catch (\Exception $ex) { |
|
| 208 | Log::error($ex); |
|
| 209 | Alert::danger('An error occured while attempting to add a new service pack.')->flash(); |
|
| 210 | } |
|
| 211 | ||
| 212 | return redirect()->back(); |
|
| 213 | } |
|
| 214 | } |
|
| 215 | ||