first(); $itemId= $item->id; if (!$item) { abort(404, "Item with code {$itemCode} not found."); } $production = ProductionQuantity::where('item_id', $item->id) ->where('serial_number', $serial) ->first(); if (!$production) { abort(404, "Production data for item code '{$itemCode}' with serial '{$serial}' not found."); } $productionOrder = $production->production_order ?? ''; if ($item->category == 'Submersible Motor') { $copies = 1; } elseif ($item->category == 'Submersible Pump') { $copies = 2; } // 5. Generate QR Code (base64) $qrCode = new QrCode($palletNo); $output = new Output\Png(); $qrBinary = $output->output($qrCode, 100); // 100 = size $qrBase64 = base64_encode($qrBinary); // 6. Return view return view('print-qr', [ 'qrBase64' => $qrBase64, 'serial' => $serial, 'productionOrder' => $productionOrder, 'item' => $item, 'copies'=> $copies, ]); } public function store(Request $request) { // } /** * Display the specified resource. */ public function show(string $id) { // } /** * Update the specified resource in storage. */ public function update(Request $request, string $id) { // } /** * Remove the specified resource from storage. */ public function destroy(string $id) { // } }