$shipment->id]); $content = $this->pdf->awb($shipment); Log::info('AWB PDF generated successfully'); return response($content, 200, [ 'Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="AWB-' . $shipment->awb_no . '.pdf"', ]); } catch (\Throwable $e) { Log::error('AWB PDF generation failed', [ 'error' => $e->getMessage(), 'trace' => $e->getTraceAsString(), ]); return response('PDF generation failed: ' . $e->getMessage(), 500); } } public function invoice(Shipment $shipment) { try { $content = $this->pdf->invoice($shipment); return response($content, 200, [ 'Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="INVOICE-' . $shipment->awb_no . '.pdf"', ]); } catch (\Throwable $e) { Log::error('Invoice PDF generation failed', ['error' => $e->getMessage()]); return response('PDF generation failed: ' . $e->getMessage(), 500); } } public function label(Shipment $shipment) { try { $content = $this->pdf->label($shipment); return response($content, 200, [ 'Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="LABEL-' . $shipment->awb_no . '.pdf"', ]); } catch (\Throwable $e) { Log::error('Label PDF generation failed', ['error' => $e->getMessage()]); return response('PDF generation failed: ' . $e->getMessage(), 500); } } }