| @@ 315-333 (lines=19) @@ | ||
| 312 | ]); |
|
| 313 | } |
|
| 314 | ||
| 315 | public function postSettingsSFTP(Request $request, $uuid) |
|
| 316 | { |
|
| 317 | $server = Models\Server::getByUUID($uuid); |
|
| 318 | $this->authorize('reset-sftp', $server); |
|
| 319 | ||
| 320 | try { |
|
| 321 | $repo = new ServerRepository; |
|
| 322 | $repo->updateSFTPPassword($server->id, $request->input('sftp_pass')); |
|
| 323 | Alert::success('Successfully updated this servers SFTP password.')->flash(); |
|
| 324 | } catch (DisplayValidationException $ex) { |
|
| 325 | return redirect()->route('server.settings.sftp', $uuid)->withErrors(json_decode($ex->getMessage())); |
|
| 326 | } catch (DisplayException $ex) { |
|
| 327 | Alert::danger($ex->getMessage())->flash(); |
|
| 328 | } catch (\Exception $ex) { |
|
| 329 | Log::error($ex); |
|
| 330 | Alert::danger('An unknown error occured while attempting to update this server\'s SFTP settings.')->flash(); |
|
| 331 | } |
|
| 332 | ||
| 333 | return redirect()->route('server.settings.sftp', $uuid); |
|
| 334 | } |
|
| 335 | ||
| 336 | public function postSettingsStartup(Request $request, $uuid) |
|
| @@ 82-103 (lines=22) @@ | ||
| 79 | ]); |
|
| 80 | } |
|
| 81 | ||
| 82 | public function postNew(Request $request, $uuid) |
|
| 83 | { |
|
| 84 | $server = Models\Server::getByUUID($uuid); |
|
| 85 | $this->authorize('create-task', $server); |
|
| 86 | ||
| 87 | try { |
|
| 88 | $repo = new Repositories\TaskRepository; |
|
| 89 | $repo->create($server->id, $request->except([ |
|
| 90 | '_token', |
|
| 91 | ])); |
|
| 92 | return redirect()->route('server.tasks', $uuid); |
|
| 93 | } catch (DisplayValidationException $ex) { |
|
| 94 | return redirect()->route('server.tasks.new', $uuid)->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 95 | } catch (DisplayException $ex) { |
|
| 96 | Alert::danger($ex->getMessage())->flash(); |
|
| 97 | } catch (\Exception $ex) { |
|
| 98 | Log::error($ex); |
|
| 99 | Alert::danger('An unknown error occured while attempting to create this task.')->flash(); |
|
| 100 | } |
|
| 101 | ||
| 102 | return redirect()->route('server.tasks.new', $uuid); |
|
| 103 | } |
|
| 104 | ||
| 105 | public function deleteTask(Request $request, $uuid, $id) |
|
| 106 | { |
|