| @@ 70-90 (lines=21) @@ | ||
| 67 | ]); |
|
| 68 | } |
|
| 69 | ||
| 70 | public function postNew(Request $request, $uuid) |
|
| 71 | { |
|
| 72 | $server = Models\Server::getByUUID($uuid); |
|
| 73 | $this->authorize('create-task', $server); |
|
| 74 | ||
| 75 | try { |
|
| 76 | $repo = new Repositories\TaskRepository; |
|
| 77 | $repo->create($server->id, $request->except([ |
|
| 78 | '_token', |
|
| 79 | ])); |
|
| 80 | } catch (DisplayValidationException $ex) { |
|
| 81 | return redirect()->route('server.tasks', $uuid)->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 82 | } catch (DisplayException $ex) { |
|
| 83 | Alert::danger($ex->getMessage())->flash(); |
|
| 84 | } catch (\Exception $ex) { |
|
| 85 | Log::error($ex); |
|
| 86 | Alert::danger('An unknown error occured while attempting to create this task.')->flash(); |
|
| 87 | } |
|
| 88 | ||
| 89 | return redirect()->route('server.tasks', $uuid); |
|
| 90 | } |
|
| 91 | ||
| 92 | public function getView(Request $request, $uuid, $id) |
|
| 93 | { |
|
| @@ 248-266 (lines=19) @@ | ||
| 245 | ]); |
|
| 246 | } |
|
| 247 | ||
| 248 | public function postSettingsSFTP(Request $request, $uuid) |
|
| 249 | { |
|
| 250 | $server = Models\Server::getByUUID($uuid); |
|
| 251 | $this->authorize('reset-sftp', $server); |
|
| 252 | ||
| 253 | try { |
|
| 254 | $repo = new ServerRepository; |
|
| 255 | $repo->updateSFTPPassword($server->id, $request->input('sftp_pass')); |
|
| 256 | Alert::success('Successfully updated this servers SFTP password.')->flash(); |
|
| 257 | } catch (DisplayValidationException $ex) { |
|
| 258 | return redirect()->route('server.settings', $uuid)->withErrors(json_decode($ex->getMessage())); |
|
| 259 | } catch (DisplayException $ex) { |
|
| 260 | Alert::danger($ex->getMessage())->flash(); |
|
| 261 | } catch (\Exception $ex) { |
|
| 262 | Log::error($ex); |
|
| 263 | Alert::danger('An unknown error occured while attempting to update this server\'s SFTP settings.')->flash(); |
|
| 264 | } |
|
| 265 | ||
| 266 | return redirect()->route('server.settings', $uuid); |
|
| 267 | } |
|
| 268 | ||
| 269 | public function postSettingsStartup(Request $request, $uuid) |
|