update console
This commit is contained in:
@@ -28,11 +28,11 @@ class ServiceController extends Controller
|
||||
/**
|
||||
* Hiển thị chi tiết service dựa trên invoice_id - FURTHER OPTIMIZED
|
||||
*/
|
||||
public function show($invoice_id, vCenter $vCenterService)
|
||||
public function show($invoice_ordernum, vCenter $vCenterService)
|
||||
{
|
||||
try {
|
||||
// Tìm invoice với các relationship cần thiết - OPTIMIZED
|
||||
$invoice = $this->invoiceRepository->findWithRelationships($invoice_id, [
|
||||
$invoice = $this->invoiceRepository->findWithRelationships($invoice_ordernum, [
|
||||
'order',
|
||||
'invoiceItem.addons',
|
||||
'invoiceItem.os.osGroup',
|
||||
@@ -334,16 +334,19 @@ class ServiceController extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function vmConsole(Request $request, $invoice_id)
|
||||
public function vmConsole(Request $request, $invoice_ordernum)
|
||||
{
|
||||
$cacheKey = 'vm_console_invoice_' . $invoice_id;
|
||||
$data = cache()->remember($cacheKey, 300, function () use ($invoice_id) {
|
||||
$invoice = \App\Models\Invoice::where('id', $invoice_id)->first();
|
||||
if (!$invoice) return null;
|
||||
$order = \App\Models\Order::find($invoice->order_id);
|
||||
if (!$order) return null;
|
||||
$product = \App\Models\ModuleVmware::where('order_id', $order->id)->first();
|
||||
if (!$product) return null;
|
||||
$cacheKey = 'vm_console_invoice_' . $invoice_ordernum;
|
||||
$data = cache()->remember($cacheKey, 300, function () use ($invoice_ordernum) {
|
||||
$invoice = Invoice::where('order_num', $invoice_ordernum)->first();
|
||||
if (!$invoice)
|
||||
return null;
|
||||
$order = Order::find($invoice->order_id);
|
||||
if (!$order)
|
||||
return null;
|
||||
$product = ModuleVmware::where('order_id', $order->id)->first();
|
||||
if (!$product)
|
||||
return null;
|
||||
$title = "VM Console - " . $product->name;
|
||||
return compact('product', 'title', 'invoice');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user