From 91805d90a77969f7486135d9d797a0eb162db047 Mon Sep 17 00:00:00 2001 From: Limber Mamani Date: Thu, 18 Apr 2024 13:11:52 -0400 Subject: [PATCH] feat: add old_id --- .../Controllers/V2/Sites/CreateSiteWithFormController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/V2/Sites/CreateSiteWithFormController.php b/app/Http/Controllers/V2/Sites/CreateSiteWithFormController.php index e3a78586f..b8e72e635 100644 --- a/app/Http/Controllers/V2/Sites/CreateSiteWithFormController.php +++ b/app/Http/Controllers/V2/Sites/CreateSiteWithFormController.php @@ -23,10 +23,14 @@ public function __invoke(Form $form, CreateEntityFormRequest $formRequest) return new JsonResponse('No Project found for this site.', 404); } + $lastOldId = Site::orderByDesc('old_id') + ->value('old_id'); + $site = Site::create([ 'framework_key' => $project->framework_key, 'project_id' => $project->id, 'status' => EntityStatusStateMachine::STARTED, + 'old_id' => $lastOldId + 1, ]); return $site->createSchemaResource();