| @@ 93-114 (lines=22) @@ | ||
| 90 | * @param int $id |
|
| 91 | * @return \Illuminate\Http\RedirectResponse |
|
| 92 | */ |
|
| 93 | public function createVariable(Request $request, $id) |
|
| 94 | { |
|
| 95 | $repo = new VariableRepository; |
|
| 96 | ||
| 97 | try { |
|
| 98 | $variable = $repo->create($id, $request->only([ |
|
| 99 | 'name', 'description', 'env_variable', |
|
| 100 | 'default_value', 'options', 'rules', |
|
| 101 | ])); |
|
| 102 | ||
| 103 | Alert::success('New variable successfully assigned to this service option.')->flash(); |
|
| 104 | } catch (DisplayValidationException $ex) { |
|
| 105 | return redirect()->route('admin.services.option.variables', $id)->withErrors(json_decode($ex->getMessage())); |
|
| 106 | } catch (DisplayException $ex) { |
|
| 107 | Alert::danger($ex->getMessage())->flash(); |
|
| 108 | } catch (\Exception $ex) { |
|
| 109 | Log::error($ex); |
|
| 110 | Alert::danger('An unhandled exception was encountered while attempting to process that request. This error has been logged.')->flash(); |
|
| 111 | } |
|
| 112 | ||
| 113 | return redirect()->route('admin.services.option.variables', $id); |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * Display option overview page. |
|
| @@ 75-97 (lines=23) @@ | ||
| 72 | * @param \Illuminate\Http\Request $request |
|
| 73 | * @return \Illuminate\Http\RedirectResponse |
|
| 74 | */ |
|
| 75 | public function create(Request $request) |
|
| 76 | { |
|
| 77 | $repo = new DatabaseRepository; |
|
| 78 | ||
| 79 | try { |
|
| 80 | $host = $repo->add($request->intersect([ |
|
| 81 | 'name', 'username', 'password', |
|
| 82 | 'host', 'port', 'node_id', |
|
| 83 | ])); |
|
| 84 | Alert::success('Successfully created new database host on the system.')->flash(); |
|
| 85 | ||
| 86 | return redirect()->route('admin.databases.view', $host->id); |
|
| 87 | } catch (\PDOException $ex) { |
|
| 88 | Alert::danger($ex->getMessage())->flash(); |
|
| 89 | } catch (DisplayValidationException $ex) { |
|
| 90 | return redirect()->route('admin.databases')->withErrors(json_decode($ex->getMessage())); |
|
| 91 | } catch (\Exception $ex) { |
|
| 92 | Log::error($ex); |
|
| 93 | Alert::danger('An error was encountered while trying to process this request. This error has been logged.')->flash(); |
|
| 94 | } |
|
| 95 | ||
| 96 | return redirect()->route('admin.databases'); |
|
| 97 | } |
|
| 98 | ||
| 99 | /** |
|
| 100 | * Handle post request to update a database host. |
|