| @@ 284-303 (lines=20) @@ | ||
| 281 | ]); |
|
| 282 | } |
|
| 283 | ||
| 284 | public function postSettingsSFTP(Request $request, $uuid) |
|
| 285 | { |
|
| 286 | $server = Models\Server::byUuid($uuid); |
|
| 287 | $this->authorize('reset-sftp', $server); |
|
| 288 | ||
| 289 | try { |
|
| 290 | $repo = new ServerRepository; |
|
| 291 | $repo->updateSFTPPassword($server->id, $request->input('sftp_pass')); |
|
| 292 | Alert::success('Successfully updated this servers SFTP password.')->flash(); |
|
| 293 | } catch (DisplayValidationException $ex) { |
|
| 294 | return redirect()->route('server.settings.sftp', $uuid)->withErrors(json_decode($ex->getMessage())); |
|
| 295 | } catch (DisplayException $ex) { |
|
| 296 | Alert::danger($ex->getMessage())->flash(); |
|
| 297 | } catch (\Exception $ex) { |
|
| 298 | Log::error($ex); |
|
| 299 | Alert::danger('An unknown error occured while attempting to update this server\'s SFTP settings.')->flash(); |
|
| 300 | } |
|
| 301 | ||
| 302 | return redirect()->route('server.settings.sftp', $uuid); |
|
| 303 | } |
|
| 304 | ||
| 305 | public function postSettingsStartup(Request $request, $uuid) |
|
| 306 | { |
|
| @@ 72-94 (lines=23) @@ | ||
| 69 | ]); |
|
| 70 | } |
|
| 71 | ||
| 72 | public function postNew(Request $request, $uuid) |
|
| 73 | { |
|
| 74 | $server = Models\Server::byUuid($uuid); |
|
| 75 | $this->authorize('create-task', $server); |
|
| 76 | ||
| 77 | try { |
|
| 78 | $repo = new Repositories\TaskRepository; |
|
| 79 | $repo->create($server->id, $request->except([ |
|
| 80 | '_token', |
|
| 81 | ])); |
|
| 82 | ||
| 83 | return redirect()->route('server.tasks', $uuid); |
|
| 84 | } catch (DisplayValidationException $ex) { |
|
| 85 | return redirect()->route('server.tasks.new', $uuid)->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 86 | } catch (DisplayException $ex) { |
|
| 87 | Alert::danger($ex->getMessage())->flash(); |
|
| 88 | } catch (\Exception $ex) { |
|
| 89 | Log::error($ex); |
|
| 90 | Alert::danger('An unknown error occured while attempting to create this task.')->flash(); |
|
| 91 | } |
|
| 92 | ||
| 93 | return redirect()->route('server.tasks.new', $uuid); |
|
| 94 | } |
|
| 95 | ||
| 96 | public function deleteTask(Request $request, $uuid, $id) |
|
| 97 | { |
|