From c4c4834acca4b0d064f4f7319e497052d4907678 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Tue, 19 Mar 2024 04:52:43 -0400 Subject: [PATCH] Fix this --- app/Services/Eggs/EggCreationService.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/Services/Eggs/EggCreationService.php b/app/Services/Eggs/EggCreationService.php index 9a4893ad4..2a5f00a4d 100644 --- a/app/Services/Eggs/EggCreationService.php +++ b/app/Services/Eggs/EggCreationService.php @@ -26,19 +26,13 @@ class EggCreationService { $data['config_from'] = array_get($data, 'config_from'); if (!is_null($data['config_from'])) { - $results = Egg::query() - ->where('nest_id', array_get($data, 'nest_id')) - ->where('id', array_get($data, 'config_from')) - ->count(); - - if ($results !== 1) { - throw new NoParentConfigurationFoundException(trans('exceptions.egg.invalid_copy_id')); - } + $parentEgg = Egg::query()->find(array_get($data, 'config_from')); + throw_unless($parentEgg, new NoParentConfigurationFoundException(trans('exceptions.egg.invalid_copy_id'))); } return Egg::query()->create(array_merge($data, [ 'uuid' => Uuid::uuid4()->toString(), - 'author' => $this->config->get('pterodactyl.service.author'), + 'author' => $this->config->get('panel.service.author'), ])); } }