diff --git a/app/Http/Controllers/Admin/Nests/EggController.php b/app/Http/Controllers/Admin/Nests/EggController.php index 209dad691..4e3dd5e94 100644 --- a/app/Http/Controllers/Admin/Nests/EggController.php +++ b/app/Http/Controllers/Admin/Nests/EggController.php @@ -78,7 +78,14 @@ class EggController extends Controller */ public function store(EggFormRequest $request): RedirectResponse { - $egg = $this->creationService->handle($request->normalize()); + $data = $request->normalize(); + if (!empty($data['docker_images']) && !is_array($data['docker_images'])) { + $data['docker_images'] = array_map(function ($value) { + return trim($value); + }, explode("\n", $data['docker_images'])); + } + + $egg = $this->creationService->handle($data); $this->alert->success(trans('admin/nests.eggs.notices.egg_created'))->flash(); return redirect()->route('admin.nests.egg.view', $egg->id); @@ -108,7 +115,14 @@ class EggController extends Controller */ public function update(EggFormRequest $request, Egg $egg): RedirectResponse { - $this->updateService->handle($egg, $request->normalize()); + $data = $request->normalize(); + if (!empty($data['docker_images']) && !is_array($data['docker_images'])) { + $data['docker_images'] = array_map(function ($value) { + return trim($value); + }, explode("\n", $data['docker_images'])); + } + + $this->updateService->handle($egg, $data); $this->alert->success(trans('admin/nests.eggs.notices.updated'))->flash(); return redirect()->route('admin.nests.egg.view', $egg->id); diff --git a/app/Http/Requests/Admin/Egg/EggFormRequest.php b/app/Http/Requests/Admin/Egg/EggFormRequest.php index bda0e8c4d..2c865f228 100644 --- a/app/Http/Requests/Admin/Egg/EggFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggFormRequest.php @@ -21,7 +21,7 @@ class EggFormRequest extends AdminFormRequest $rules = [ 'name' => 'required|string|max:191', 'description' => 'nullable|string', - 'docker_image' => 'required|string|max:191', + 'docker_images' => 'required|string', 'startup' => 'required|string', 'config_from' => 'sometimes|bail|nullable|numeric', 'config_stop' => 'required_without:config_from|nullable|string|max:191', diff --git a/resources/views/admin/eggs/new.blade.php b/resources/views/admin/eggs/new.blade.php index 474d989a7..516ac861a 100644 --- a/resources/views/admin/eggs/new.blade.php +++ b/resources/views/admin/eggs/new.blade.php @@ -53,13 +53,13 @@
- - -

The default docker image that should be used for new servers using this Egg. This can be changed per-server.

+ + +

The docker images available to servers using this egg. Enter one per line. Users will be able to select from this list of images if more than one value is provided.

- +

The default startup command that should be used for new servers created with this Egg. You can change this per-server as needed.

diff --git a/resources/views/admin/eggs/view.blade.php b/resources/views/admin/eggs/view.blade.php index bf2414fb2..7a235e069 100644 --- a/resources/views/admin/eggs/view.blade.php +++ b/resources/views/admin/eggs/view.blade.php @@ -82,20 +82,20 @@

The author of this version of the Egg. Uploading a new Egg configuration from a different author will change this.

- - -

The default docker image that should be used for new servers using this Egg. This can be changed per-server as needed.

+ + +

The docker images available to servers using this egg. Enter one per line. Users will be able to select from this list of images if more than one value is provided.

- +

A description of this Egg that will be displayed throughout the Panel as needed.

- +

The default startup command that should be used for new servers using this Egg.