From 5362d3bcb124d23539905e7b99c10fd563389182 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 23 Nov 2026 15:57:37 +0530 Subject: [PATCH] Added validation characteristics name invalid in pdf controller --- app/Http/Controllers/PdfController.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/Http/Controllers/PdfController.php b/app/Http/Controllers/PdfController.php index 2eeea51c..e4c72cf7 100644 --- a/app/Http/Controllers/PdfController.php +++ b/app/Http/Controllers/PdfController.php @@ -10,6 +10,7 @@ use App\Models\Machine; use App\Models\Plant; use App\Models\ProcessOrder; use App\Models\ProductionCharacteristic; +use App\Models\ProductCharacteristicsMaster; use App\Models\ProductionQuantity; use App\Models\Shift; use App\Models\User; @@ -258,6 +259,18 @@ class PdfController extends Controller $errorMessage = "Row " . ($index + 1) . ": Status must be either Ok or NotOk."; break; } + + // Validate characteristic against product_characteristics_master + $characteristicExists = ProductCharacteristicsMaster::where('plant_id', $plantId) + ->where('line_id', $lineId) + ->where('item_id', $itemId) + ->where('name', $characteristicsName) + ->first(); + + if (!$characteristicExists) { + $errorMessage = "Row " . ($index + 1) . ": Characteristic '{$characteristicsName}' not found for plant '{$plantName}', line '{$lineName}' and item code '{$itemCode}'."; + break; + } } if ($errorMessage != '') { -- 2.49.1