Skip to content

Commit

Permalink
feat: add old_id (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
LimberHope authored Apr 18, 2024
1 parent a4da1c9 commit 37f1320
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 37f1320

Please sign in to comment.