| @@ 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 | /** |
|
| @@ 59-77 (lines=19) @@ | ||
| 56 | return view('admin.services.new'); |
|
| 57 | } |
|
| 58 | ||
| 59 | public function postNew(Request $request) |
|
| 60 | { |
|
| 61 | try { |
|
| 62 | $repo = new ServiceRepository\Service; |
|
| 63 | $id = $repo->create($request->except([ |
|
| 64 | '_token', |
|
| 65 | ])); |
|
| 66 | Alert::success('Successfully created new service!')->flash(); |
|
| 67 | ||
| 68 | return redirect()->route('admin.services.service', $id); |
|
| 69 | } catch (DisplayValidationException $ex) { |
|
| 70 | return redirect()->route('admin.services.new')->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 71 | } catch (DisplayException $ex) { |
|
| 72 | Alert::danger($ex->getMessage())->flash(); |
|
| 73 | } catch (\Exception $ex) { |
|
| 74 | Log::error($ex); |
|
| 75 | Alert::danger('An error occured while attempting to add a new service.')->flash(); |
|
| 76 | } |
|
| 77 | ||
| 78 | return redirect()->route('admin.services.new')->withInput(); |
|
| 79 | } |
|
| 80 | ||
| @@ 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 | ||