From 588d9ea03c5a04c7cd926cae1dc1560814bedafe Mon Sep 17 00:00:00 2001 From: jose-carlos-sousa <139002032+jose-carlos-sousa@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:54:03 +0100 Subject: [PATCH] fix: error code for participant not enrolled --- app/Http/Controllers/QuestApiController.php | 2 +- app/Http/Controllers/QuestController.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Http/Controllers/QuestApiController.php b/app/Http/Controllers/QuestApiController.php index ee45fb7..f0b71f3 100644 --- a/app/Http/Controllers/QuestApiController.php +++ b/app/Http/Controllers/QuestApiController.php @@ -50,7 +50,7 @@ public function give(Request $request, Quest $quest): JsonResponse return response()->json([ 'status' => 'error', 'message' => 'Participant not enrolled in this edition!', - ], 400); + ], 412); } try { diff --git a/app/Http/Controllers/QuestController.php b/app/Http/Controllers/QuestController.php index 2d299cf..cce8f39 100644 --- a/app/Http/Controllers/QuestController.php +++ b/app/Http/Controllers/QuestController.php @@ -15,7 +15,6 @@ public function give(Request $request, Quest $quest) $request->validate([ 'quest_code' => 'required|exists:participants,quest_code', ]); - $edition = $request->input('edition'); $participant = Participant::firstWhere('quest_code', $request->get('quest_code')); $enrollment = $participant->enrollments()->where('edition_id', $edition?->id)->first();