diff --git a/app/Services/Eggs/Sharing/EggImporterService.php b/app/Services/Eggs/Sharing/EggImporterService.php index 0a949474f..7ed7f010a 100644 --- a/app/Services/Eggs/Sharing/EggImporterService.php +++ b/app/Services/Eggs/Sharing/EggImporterService.php @@ -26,8 +26,11 @@ class EggImporterService $parsed = $this->parser->handle($file); return $this->connection->transaction(function () use ($parsed) { - $egg = (new Egg())->forceFill([ - 'uuid' => Uuid::uuid4()->toString(), + $uuid = $parsed['uuid'] ?? Uuid::uuid4()->toString(); + $egg = Egg::where('uuid', $uuid)->first() ?? new Egg(); + + $egg = $egg->forceFill([ + 'uuid' => $uuid, 'author' => Arr::get($parsed, 'author'), 'copy_script_from' => null, ]);