@@ 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 |
@@ 231-251 (lines=21) @@ | ||
228 | ]); |
|
229 | } |
|
230 | ||
231 | public function postUpload(Request $request) |
|
232 | { |
|
233 | try { |
|
234 | $repo = new Pack; |
|
235 | $id = $repo->createWithTemplate($request->except([ |
|
236 | '_token', |
|
237 | ])); |
|
238 | Alert::success('Successfully created new service!')->flash(); |
|
239 | ||
240 | return redirect()->route('admin.services.packs.edit', $id)->withInput(); |
|
241 | } catch (DisplayValidationException $ex) { |
|
242 | return redirect()->back()->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
243 | } catch (DisplayException $ex) { |
|
244 | Alert::danger($ex->getMessage())->flash(); |
|
245 | } catch (\Exception $ex) { |
|
246 | Log::error($ex); |
|
247 | Alert::danger('An error occured while attempting to add a new service pack.')->flash(); |
|
248 | } |
|
249 | ||
250 | return redirect()->back(); |
|
251 | } |
|
252 | } |
|
253 |
@@ 60-78 (lines=19) @@ | ||
57 | return view('admin.services.new'); |
|
58 | } |
|
59 | ||
60 | public function postNew(Request $request) |
|
61 | { |
|
62 | try { |
|
63 | $repo = new ServiceRepository\Service; |
|
64 | $id = $repo->create($request->except([ |
|
65 | '_token', |
|
66 | ])); |
|
67 | Alert::success('Successfully created new service!')->flash(); |
|
68 | ||
69 | return redirect()->route('admin.services.service', $id); |
|
70 | } catch (DisplayValidationException $ex) { |
|
71 | return redirect()->route('admin.services.new')->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
72 | } catch (DisplayException $ex) { |
|
73 | Alert::danger($ex->getMessage())->flash(); |
|
74 | } catch (\Exception $ex) { |
|
75 | Log::error($ex); |
|
76 | Alert::danger('An error occured while attempting to add a new service.')->flash(); |
|
77 | } |
|
78 | ||
79 | return redirect()->route('admin.services.new')->withInput(); |
|
80 | } |
|
81 |