Merge pull request 'Added POST API logs to view the structure in command prompt' (#10) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #10
This commit was merged in pull request #10.
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Models\Plant;
|
||||
use App\Models\ProcessOrder;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Str;
|
||||
@@ -21,6 +22,7 @@ class PdfController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function updateGR(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
@@ -29,30 +31,26 @@ class PdfController extends Controller
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
|
||||
if ("Bearer " . $expectedToken != $header_auth)
|
||||
{
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!'
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
$data = $request->all();
|
||||
|
||||
if ($data['plant_code'] == null || $data['plant_code'] == '')
|
||||
{
|
||||
if ($data['plant_code'] == null || $data['plant_code'] == '') {
|
||||
// return response("ERROR: Please provide a valid plant code.", 400)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code can't be empty!"
|
||||
'status_description' => "Plant code can't be empty!",
|
||||
], 400);
|
||||
}
|
||||
else if (Str::length($data['plant_code']) < 4 || !is_numeric($data['plant_code']) || !preg_match('/^[1-9]\d{3,}$/', $data['plant_code']))//!ctype_digit($data['plant_code'])
|
||||
{
|
||||
} elseif (Str::length($data['plant_code']) < 4 || ! is_numeric($data['plant_code']) || ! preg_match('/^[1-9]\d{3,}$/', $data['plant_code'])) {// !ctype_digit($data['plant_code'])
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Invalid plant code found!"
|
||||
'status_description' => 'Invalid plant code found!',
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -60,16 +58,15 @@ class PdfController extends Controller
|
||||
if (! $plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant not found!'
|
||||
'status_description' => 'Plant not found!',
|
||||
], 400);
|
||||
}
|
||||
|
||||
$plantId = $plant->id;
|
||||
if ($data['gr_number'] == null || $data['gr_number'] == '')
|
||||
{
|
||||
if ($data['gr_number'] == null || $data['gr_number'] == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "GR Number can't be empty!"
|
||||
'status_description' => "GR Number can't be empty!",
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -80,7 +77,7 @@ class PdfController extends Controller
|
||||
if (! $grExists) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "GR Number {$data['gr_number']} not found for plant {$data['plant_code']}!"
|
||||
'status_description' => "GR Number {$data['gr_number']} not found for plant {$data['plant_code']}!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -89,7 +86,7 @@ class PdfController extends Controller
|
||||
if ($scannedBy == '' || $scannedBy == null) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Scanned by can't be empty!"
|
||||
'status_description' => "Scanned by can't be empty!",
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -99,7 +96,7 @@ class PdfController extends Controller
|
||||
if (! $user) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "'{$data['scanned_by']}' user not found!"
|
||||
'status_description' => "'{$data['scanned_by']}' user not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -111,7 +108,7 @@ class PdfController extends Controller
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Duplicate item codes found in request!',
|
||||
'duplicate_item_codes' => array_values($duplicateItemCodes)
|
||||
'duplicate_item_codes' => array_values($duplicateItemCodes),
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -131,7 +128,7 @@ class PdfController extends Controller
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Duplicate serial numbers found in request!',
|
||||
'duplicate_serial_numbers' => array_values($duplicateSerials)
|
||||
'duplicate_serial_numbers' => array_values($duplicateSerials),
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -154,26 +151,26 @@ class PdfController extends Controller
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Some item codes are invalid: must be at least 6 digits!',
|
||||
'invalid_item_codes' => array_values($invalidLengthItemCodes)
|
||||
'invalid_item_codes' => array_values($invalidLengthItemCodes),
|
||||
], 400);
|
||||
}
|
||||
|
||||
|
||||
$invalidItemCodes = [];
|
||||
$invalidPlantItems = [];
|
||||
|
||||
foreach ($data['item_codes'] as $item)
|
||||
{
|
||||
foreach ($data['item_codes'] as $item) {
|
||||
$itemCode = $item['item_code'] ?? null;
|
||||
|
||||
if (! $itemCode) {
|
||||
$invalidItemCodes[] = "(missing)";
|
||||
$invalidItemCodes[] = '(missing)';
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$itemObj = Item::where('code', $itemCode)->first();
|
||||
if (! $itemObj) {
|
||||
$invalidItemCodes[] = $itemCode;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -189,7 +186,7 @@ class PdfController extends Controller
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Some item codes are invalid!',
|
||||
'not_found_items' => array_values($invalidItemCodes),
|
||||
'not_in_plant' => array_values($invalidPlantItems)
|
||||
'not_in_plant' => array_values($invalidPlantItems),
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -228,14 +225,13 @@ class PdfController extends Controller
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Some serial numbers not found in DB for given plant, GR number, and item!',
|
||||
'missing_serials' => $missingSerialsByItem
|
||||
'missing_serials' => $missingSerialsByItem,
|
||||
], 400);
|
||||
}
|
||||
|
||||
$alreadyCompleted = [];
|
||||
|
||||
foreach ($data['item_codes'] as $item)
|
||||
{
|
||||
foreach ($data['item_codes'] as $item) {
|
||||
$itemCode = $item['item_code'];
|
||||
$serialNumbers = $item['serial_numbers'];
|
||||
|
||||
@@ -262,7 +258,7 @@ class PdfController extends Controller
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Below serial numbers are already completed',
|
||||
'serial_numbers' => $alreadyCompleted
|
||||
'serial_numbers' => $alreadyCompleted,
|
||||
], 400);
|
||||
}
|
||||
// {
|
||||
@@ -286,7 +282,6 @@ class PdfController extends Controller
|
||||
// ], 400);
|
||||
// }
|
||||
|
||||
|
||||
// $itemId = $itemObj->id;
|
||||
|
||||
// // Update all serial numbers for this item
|
||||
@@ -297,9 +292,7 @@ class PdfController extends Controller
|
||||
// ->update(['created_by' => $scannedBy]);
|
||||
// }
|
||||
|
||||
|
||||
foreach ($data['item_codes'] as $item)
|
||||
{
|
||||
foreach ($data['item_codes'] as $item) {
|
||||
$itemCode = $item['item_code'];
|
||||
$serialNumbers = $item['serial_numbers'];
|
||||
|
||||
@@ -309,12 +302,12 @@ class PdfController extends Controller
|
||||
->where('item_id', $itemId)
|
||||
->where('gr_number', $data['gr_number'])
|
||||
->whereIn('serial_number', $serialNumbers)
|
||||
->update(['created_by' => $scannedBy, 'status' => 'Completed',]);
|
||||
->update(['created_by' => $scannedBy, 'status' => 'Completed']);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'SUCCESS',
|
||||
'status_description' => 'Serial numbers updated successfully!'
|
||||
'status_description' => 'Serial numbers updated successfully!',
|
||||
], 200);
|
||||
|
||||
}
|
||||
@@ -333,18 +326,16 @@ class PdfController extends Controller
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
|
||||
if ("Bearer " . $expectedToken != $header_auth)
|
||||
{
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!'
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
$filename = $request->header('process-order');
|
||||
|
||||
if (!$filename)
|
||||
{
|
||||
if (! $filename) {
|
||||
return response()->json(['error' => 'Missing file-name header'], 400);
|
||||
}
|
||||
|
||||
@@ -355,7 +346,7 @@ class PdfController extends Controller
|
||||
$filename .= '.pdf';
|
||||
}
|
||||
|
||||
$filePath = "uploads/ProcessOrder/" . $filename;
|
||||
$filePath = 'uploads/ProcessOrder/'.$filename;
|
||||
|
||||
if (! Storage::disk('local')->exists($filePath)) {
|
||||
return response()->json(['error' => 'File not found'], 404);
|
||||
@@ -382,21 +373,19 @@ class PdfController extends Controller
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
|
||||
if ("Bearer " . $expectedToken != $header_auth)
|
||||
{
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!'
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
$filename = $request->header('gr-number');
|
||||
|
||||
if (!$filename)
|
||||
{
|
||||
if (! $filename) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Gr Number cannot be empty!'
|
||||
'status_description' => 'Gr Number cannot be empty!',
|
||||
], 403);
|
||||
// return response()->json(['error' => 'Missing file-name header'], 400);
|
||||
}
|
||||
@@ -408,13 +397,13 @@ class PdfController extends Controller
|
||||
$filename .= '.pdf';
|
||||
}
|
||||
|
||||
$filePath = "uploads/GRNumber/" . $filename;
|
||||
$filePath = 'uploads/GRNumber/'.$filename;
|
||||
|
||||
if (! Storage::disk('local')->exists($filePath)) {
|
||||
// return response()->json(['error' => 'File not found'], 404);
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Pdf File not found for the provided GrNumber!'
|
||||
'status_description' => 'Pdf File not found for the provided GrNumber!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
@@ -435,11 +424,10 @@ class PdfController extends Controller
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
|
||||
if ("Bearer " . $expectedToken != $header_auth)
|
||||
{
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!'
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
@@ -447,18 +435,15 @@ class PdfController extends Controller
|
||||
|
||||
$grNumber = $request->header('gr-number');
|
||||
|
||||
|
||||
if (! $plantCode) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant Code value can't be empty"
|
||||
'status_description' => "Plant Code value can't be empty",
|
||||
], 404);
|
||||
}
|
||||
else if (!$grNumber)
|
||||
{
|
||||
} elseif (! $grNumber) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'GR Number cannot be empty!'
|
||||
'status_description' => 'GR Number cannot be empty!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
@@ -468,7 +453,7 @@ class PdfController extends Controller
|
||||
if (! $plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant Code '{$plantCode}' not found!"
|
||||
'status_description' => "Plant Code '{$plantCode}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -477,7 +462,7 @@ class PdfController extends Controller
|
||||
if (! $grExist) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'GR Number not found'
|
||||
'status_description' => 'GR Number not found',
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -488,7 +473,7 @@ class PdfController extends Controller
|
||||
if (! $grExists) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'GR Number not found for this plant!'
|
||||
'status_description' => 'GR Number not found for this plant!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -499,7 +484,7 @@ class PdfController extends Controller
|
||||
if (empty($grRecords)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'No serial numbers found for the given GR number!'
|
||||
'status_description' => 'No serial numbers found for the given GR number!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -523,7 +508,7 @@ class PdfController extends Controller
|
||||
$result = $grRecords->groupBy('item_id')->map(function ($group, $itemId) use ($items) {
|
||||
return [
|
||||
'item_code' => $items[$itemId] ?? null,
|
||||
'serial_numbers' => $group->pluck('serial_number')->toArray()
|
||||
'serial_numbers' => $group->pluck('serial_number')->toArray(),
|
||||
];
|
||||
})->values(); // remove keys
|
||||
|
||||
@@ -537,11 +522,10 @@ class PdfController extends Controller
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
|
||||
if ("Bearer " . $expectedToken != $header_auth)
|
||||
{
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!'
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
@@ -549,18 +533,15 @@ class PdfController extends Controller
|
||||
|
||||
$processOrder = $request->header('process-order');
|
||||
|
||||
|
||||
if (! $plantCode) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant Code value can't be empty"
|
||||
'status_description' => "Plant Code value can't be empty",
|
||||
], 404);
|
||||
}
|
||||
else if (!$processOrder)
|
||||
{
|
||||
} elseif (! $processOrder) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Process Order cannot be empty!'
|
||||
'status_description' => 'Process Order cannot be empty!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
@@ -570,7 +551,7 @@ class PdfController extends Controller
|
||||
if (! $plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant Code '{$plantCode}' not found!"
|
||||
'status_description' => "Plant Code '{$plantCode}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -579,7 +560,7 @@ class PdfController extends Controller
|
||||
if (! $processOrderExist) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Process order not found'
|
||||
'status_description' => 'Process order not found',
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -590,11 +571,10 @@ class PdfController extends Controller
|
||||
if (! $proOrdAgPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Process order not found for this plant!'
|
||||
'status_description' => 'Process order not found for this plant!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
|
||||
$item = $proOrdAgPlant->item;
|
||||
|
||||
$processOrderRecords = ProcessOrder::with('item')
|
||||
@@ -615,7 +595,7 @@ class PdfController extends Controller
|
||||
if ($totalReceivedQty == $proOrdAgPlant->order_quantity) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Process order '{$processOrder}' for plant '{$plantCode}' has already reached its order quantity."
|
||||
'status_description' => "Process order '{$processOrder}' for plant '{$plantCode}' has already reached its order quantity.",
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -627,13 +607,13 @@ class PdfController extends Controller
|
||||
// }
|
||||
|
||||
return response()->json([
|
||||
'item_code' => $item?->code ?? "",
|
||||
'description' => $item?->description ?? "",
|
||||
'item_code' => $item?->code ?? '',
|
||||
'description' => $item?->description ?? '',
|
||||
// 'coil_number' => $proOrdAgPlant->coil_number ?? "",
|
||||
// 'order_quantity' => (string)$proOrdAgPlant->order_quantity ?? "",
|
||||
'coil_number' => $lastRecord->coil_number ?? "",
|
||||
'order_quantity' => (string)$lastRecord->order_quantity ?? "",
|
||||
'received_quantity' => (string)$totalReceivedQty ?? "",
|
||||
'coil_number' => $lastRecord->coil_number ?? '',
|
||||
'order_quantity' => (string) $lastRecord->order_quantity ?? '',
|
||||
'received_quantity' => (string) $totalReceivedQty ?? '',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -642,22 +622,24 @@ class PdfController extends Controller
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$headerAuth = $request->header('Authorization');
|
||||
$expectedToken = "Bearer " . $expectedUser . ':' . $expectedPw;
|
||||
$expectedToken = 'Bearer '.$expectedUser.':'.$expectedPw;
|
||||
|
||||
if ($headerAuth !== $expectedToken) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!'
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
Log::info('POST : Process Orders API called', ['request_data' => $request->all()]);
|
||||
|
||||
$plantCode = $request->header('plant-code');
|
||||
$processOrder = $request->header('process-order');
|
||||
|
||||
if (! $plantCode || ! $processOrder) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'plant-code and process-order are required'
|
||||
'status_description' => 'plant-code and process-order are required',
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -665,7 +647,7 @@ class PdfController extends Controller
|
||||
if (! $plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid plant code'
|
||||
'status_description' => 'Invalid plant code',
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -683,10 +665,9 @@ class PdfController extends Controller
|
||||
->where('plant_id', $plantId)
|
||||
->first();
|
||||
|
||||
if (!$item)
|
||||
{
|
||||
if (! $item) {
|
||||
return response()->json([
|
||||
'message' => 'Invalid item_code for this plant'
|
||||
'message' => 'Invalid item_code for this plant',
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -697,7 +678,7 @@ class PdfController extends Controller
|
||||
if (! $user) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "User '{$createdBy}' not found"
|
||||
'status_description' => "User '{$createdBy}' not found",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -709,7 +690,7 @@ class PdfController extends Controller
|
||||
if ($existing) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Process order '{$processOrder}' for plant '{$plantCode}' already has item_code '{$existing->item->code}'"
|
||||
'status_description' => "Process order '{$processOrder}' for plant '{$plantCode}' already has item_code '{$existing->item->code}'",
|
||||
], 409);
|
||||
}
|
||||
|
||||
@@ -734,39 +715,35 @@ class PdfController extends Controller
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Received quantity cannot exceed order quantity.
|
||||
Order Qty = {$orderQty}, Already Received = {$alreadyReceived},
|
||||
Trying to Insert = {$newReceived}"
|
||||
Order Qty = {$orderQty}, Already Received = {$alreadyReceived},Trying to Insert = {$newReceived}",
|
||||
], 404);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
ProcessOrder::Create(
|
||||
[
|
||||
'plant_id' => $plant->id,
|
||||
'process_order' => $processOrder,
|
||||
'item_id' => $item->id,
|
||||
'coil_number' => $validated['coil_number'] ?? "",
|
||||
'coil_number' => $validated['coil_number'] ?? '',
|
||||
'order_quantity' => $validated['order_quantity'] ?? 0,
|
||||
'received_quantity' => $validated['received_quantity'] ?? 0,
|
||||
'created_by' => $validated['created_by'] ?? "",
|
||||
'created_by' => $validated['created_by'] ?? '',
|
||||
]
|
||||
);
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'SUCCESS',
|
||||
'status_description' => 'Record Inserted Successfully'
|
||||
'status_description' => 'Record Inserted Successfully',
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => $e->getMessage()
|
||||
'status_description' => $e->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user