feat: implement VM snapshot management, enhance client resource loading, and refactor deployment workflow for production

This commit is contained in:
pbao9
2026-05-11 11:09:55 +07:00
parent 8aef607e1f
commit 96778e7bed
51 changed files with 2536 additions and 1249 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace App\Services;
use App\Models\Invoice;
use App\Models\Setting;
use Barryvdh\DomPDF\Facade\Pdf;
class InvoicePdfService
{
public function generate(Invoice $invoice): string
{
$invoice->load(['invoiceItems.product', 'customer', 'order.orderItems']);
$setting = Setting::where('key', 'setting')->first();
$settingValue = $setting ? json_decode((string) $setting->value) : null;
$customer = $invoice->customer;
$order = $invoice->order;
$data = [
'invoice' => $invoice,
'invoiceItems' => $invoice->invoiceItems,
'customer' => $customer,
'order' => $order,
'companyName' => $settingValue->company ?? 'Thế Giới Số',
'companyAddress' => $settingValue->address ?? '',
'companyPhone' => $settingValue->phone ?? '',
'companyEmail' => $settingValue->email ?? '',
];
return Pdf::loadView('pdf.invoice', $data)->output();
}
public function generateFileName(Invoice $invoice): string
{
return 'Hoa-don-' . $invoice->invoice_number . '.pdf';
}
}