diff --git a/app/Http/Controllers/Admin/ServiceController.php b/app/Http/Controllers/Admin/ServiceController.php
index 981a8b326..ed475660a 100644
--- a/app/Http/Controllers/Admin/ServiceController.php
+++ b/app/Http/Controllers/Admin/ServiceController.php
@@ -107,7 +107,19 @@ class ServiceController extends Controller
public function postOption(Request $request, $option)
{
- // editing option
+ try {
+ $repo = new ServiceRepository\Option;
+ $repo->update($option, $request->except([
+ '_token'
+ ]));
+ Alert::success('Option settings successfully updated.')->flash();
+ } catch (DisplayValidationException $ex) {
+ return redirect()->route('admin.services.option', $option)->withErrors(json_decode($ex->getMessage()))->withInput();
+ } catch (\Exception $ex) {
+ Log::error($ex);
+ Alert::danger('An error occured while attempting to modify this option.')->flash();
+ }
+ return redirect()->route('admin.services.option', $option)->withInput();
}
public function postOptionVariable(Request $request, $option, $variable)
diff --git a/app/Repositories/ServiceRepository/Option.php b/app/Repositories/ServiceRepository/Option.php
index 0b4d705c8..92c4dd369 100644
--- a/app/Repositories/ServiceRepository/Option.php
+++ b/app/Repositories/ServiceRepository/Option.php
@@ -42,7 +42,31 @@ class Option
public function update($id, array $data)
{
+ $option = Models\ServiceOptions::findOrFail($id);
+ $validator = Validator::make($data, [
+ 'name' => 'sometimes|required|string|max:255',
+ 'description' => 'sometimes|required|string|min:1',
+ 'tag' => 'sometimes|required|string|max:255',
+ 'executable' => 'sometimes|string|max:255',
+ 'docker_image' => 'sometimes|required|string|max:255',
+ 'startup' => 'sometimes|string'
+ ]);
+
+ if ($validator->fails()) {
+ throw new DisplayValidationException($validator->errors());
+ }
+
+ if (isset($data['executable']) && empty($data['executable'])) {
+ $data['executable'] = null;
+ }
+
+ if (isset($data['startup']) && empty($data['startup'])) {
+ $data['startup'] = null;
+ }
+
+ $option->fill($data);
+ $option->save();
}
}
diff --git a/resources/views/admin/services/options/view.blade.php b/resources/views/admin/services/options/view.blade.php
index 1eb51173f..aca4d83e1 100644
--- a/resources/views/admin/services/options/view.blade.php
+++ b/resources/views/admin/services/options/view.blade.php
@@ -31,28 +31,64 @@
{{ $service->name }}
{{ $option->name }}
- Servers
-
- Option Variables
+ Warning! This page contains advanced settings that the panel and daemon use to control servers. Modifying information on this page is not recommended unless you are absolutely sure of what you are doing.
+ Settings
+
+ Variables
@foreach($variables as $variable)
@endforeach
+ Servers
+