Merge pull request #303 from pelican-dev/issue/290
Allow updating of existing eggs via upload
This commit is contained in:
commit
abc99cd928
@ -25,6 +25,7 @@ class EggExporterService
|
|||||||
'exported_at' => Carbon::now()->toAtomString(),
|
'exported_at' => Carbon::now()->toAtomString(),
|
||||||
'name' => $egg->name,
|
'name' => $egg->name,
|
||||||
'author' => $egg->author,
|
'author' => $egg->author,
|
||||||
|
'uuid' => $egg->uuid,
|
||||||
'description' => $egg->description,
|
'description' => $egg->description,
|
||||||
'features' => $egg->features,
|
'features' => $egg->features,
|
||||||
'docker_images' => $egg->docker_images,
|
'docker_images' => $egg->docker_images,
|
||||||
|
@ -26,8 +26,11 @@ class EggImporterService
|
|||||||
$parsed = $this->parser->handle($file);
|
$parsed = $this->parser->handle($file);
|
||||||
|
|
||||||
return $this->connection->transaction(function () use ($parsed) {
|
return $this->connection->transaction(function () use ($parsed) {
|
||||||
$egg = (new Egg())->forceFill([
|
$uuid = $parsed['uuid'] ?? Uuid::uuid4()->toString();
|
||||||
'uuid' => Uuid::uuid4()->toString(),
|
$egg = Egg::where('uuid', $uuid)->first() ?? new Egg();
|
||||||
|
|
||||||
|
$egg = $egg->forceFill([
|
||||||
|
'uuid' => $uuid,
|
||||||
'author' => Arr::get($parsed, 'author'),
|
'author' => Arr::get($parsed, 'author'),
|
||||||
'copy_script_from' => null,
|
'copy_script_from' => null,
|
||||||
]);
|
]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user