Updated plant validation logic and added bundle_quantity in get_master api
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled

This commit is contained in:
dhanabalan
2026-04-30 15:10:44 +05:30
parent d71e3e9645
commit c568c2c8f7

View File

@@ -48,7 +48,17 @@ class StickerMasterController extends Controller
'status_code' => 'ERROR',
'status_description' => "Plant code can't be empty!",
], 400);
} elseif (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
} elseif (! is_numeric($plantCode)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Plant code should contain only numeric values!',
], 400);
} elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Plant code must be between 4 and 7 digits only!',
], 400);
} elseif (! preg_match('/^[1-9]\d{6,}$/', $plantCode)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid plant code found!',
@@ -170,7 +180,17 @@ class StickerMasterController extends Controller
'status_code' => 'ERROR',
'status_description' => "Plant code can't be empty!",
], 400);
} elseif (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
} elseif (! is_numeric($plantCode)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Plant code should contain only numeric values!',
], 400);
} elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Plant code must be between 4 and 7 digits only!',
], 400);
} elseif (! preg_match('/^[1-9]\d{6,}$/', $plantCode)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid plant code found!',
@@ -192,7 +212,7 @@ class StickerMasterController extends Controller
if (! $plant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Plant not found!',
'status_description' => 'Plant Code not found!',
], 400);
}
@@ -212,7 +232,7 @@ class StickerMasterController extends Controller
if (! $item) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item Code not found in item table for the plant : '$plant->name'!",
'status_description' => "Item Code not found for the plant : '$plant->name' in item table!",
], 404);
}
@@ -238,7 +258,7 @@ class StickerMasterController extends Controller
if (! $stickerMaster) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item Code not found in sticker master table for the plant : '$plant->name'!",
'status_description' => "Item Code not found for the plant : '$plant->name' in sticker master table!",
], 404);
}
@@ -250,6 +270,7 @@ class StickerMasterController extends Controller
'Part_Validation_3' => $stickerMaster?->laser_part_validation3 ?? '',
'Part_Validation_4' => $stickerMaster?->laser_part_validation4 ?? '',
'Part_Validation_5' => $stickerMaster?->laser_part_validation5 ?? '',
'bundle_quantity' => (string) $stickerMaster?->bundle_quantity ?? '0',
];
return response()->json($output, 200);