argument('order_id'); $this->info("Testing full VM process for Order #{$orderId}"); try { // Tìm order $order = Order::with(['orderItems.addons', 'customer'])->find($orderId); if (!$order) { $this->error("Order #{$orderId} not found!"); return 1; } $this->info("Found order: {$order->order_num}"); $this->info("Customer: {$order->customer->email}"); $this->info("Order items count: " . $order->orderItems->count()); // Tìm invoice $invoice = Invoice::where('order_id', $orderId)->first(); if (!$invoice) { $this->error("Invoice for Order #{$orderId} not found!"); return 1; } $this->info("Found invoice: #{$invoice->id}"); $this->info("Current VM ID: " . ($invoice->vm_id ?? 'NULL')); // Test từng order item foreach ($order->orderItems as $item) { $this->info("\n--- Testing Order Item #{$item->id} ---"); $this->info("Product Type: {$item->product_type}"); $this->info("Server Name: {$item->server_name}"); $this->info("Addons count: " . $item->addons->count()); if ($item->addons->count() > 0) { $this->info("Addons:"); foreach ($item->addons as $addon) { $this->info(" - {$addon->addonItems->name}: {$addon->qty} {$addon->addonItems->prefix}"); } } // Dispatch job để test $this->info("Dispatching CreateVirtualMachineJob..."); CreateVirtualMachineJob::dispatch($item); $this->info("Job dispatched successfully!"); } $this->info("\n✅ Full VM process test completed!"); $this->info("Check logs for detailed information about the process."); return 0; } catch (\Exception $e) { $this->error("Error: " . $e->getMessage()); Log::error('TestFullVMProcess error: ' . $e->getMessage()); return 1; } } }