From fb31d914760be1386f256954de5ecd7f6e288de0 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Fri, 1 May 2026 14:14:27 -0400 Subject: [PATCH] fix: ensure judgingentry always fetches data regardless of request method --- app/Http/Controllers/PagesController.php | 34 +++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index df209b3..6000c7c 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -377,25 +377,23 @@ class PagesController extends Controller } public function judgingentry(Request $judgingentry_req) { - if (!$judgingentry_req->vehnum) { - $judges = \App\Models\Judges::all(); - $vehicles = \App\Models\Vehicles::all(); - return view('judgingentry', ['judges' => $judges, 'vehicles' => $vehicles]); - } - $vehicle = $judgingentry_req->vehnum; - $judge = $judgingentry_req->judgenum; - $score = $judgingentry_req->vehscore; - $bidder_insert = VehicleScores::updateOrCreate( - [ - 'vehicle' => $vehicle, - 'judge' => $judge - ], - [ - 'overall_score' => $score - ] - ); + $judges = \App\Models\Judges::all(); + $vehicles = \App\Models\Vehicles::all(); - return redirect('judgingentry'); + if ($judgingentry_req->isMethod('post')) { + $vehicle = $judgingentry_req->vehnum; + $judge = $judgingentry_req->judgenum; + $score = $judgingentry_req->vehscore; + + VehicleScores::updateOrCreate( + ['vehicle' => $vehicle, 'judge' => $judge], + ['overall_score' => $score] + ); + + return redirect('judgingentry'); + } + + return view('judgingentry', ['judges' => $judges, 'vehicles' => $vehicles]); } public function showcars(Request $showcar_req)