feat: Reorganize database migrations for module snapshots, VMware, and OS groups, and implement customer order creation email notifications.
This commit is contained in:
@@ -14,6 +14,7 @@ use App\Models\ModuleVmware;
|
||||
use App\Models\ModuleIpAddress;
|
||||
use App\Models\IpPool;
|
||||
use App\Models\Log as CustomerLog;
|
||||
use App\Models\Service;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
@@ -255,6 +256,22 @@ class CreateVirtualMachineJob implements ShouldQueue
|
||||
|
||||
AssignIPJob::dispatch($vmId, $moduleVmware->id, $moduleIpAddress->ip)
|
||||
->delay(now()->addMinutes(5));
|
||||
|
||||
// Lưu Service record để track dịch vụ của khách hàng
|
||||
Service::create([
|
||||
'customer_id' => $customer->id,
|
||||
'product_id' => $this->item->product_id,
|
||||
'order_item_id' => $this->item->id,
|
||||
'invoice_id' => $invoice?->id,
|
||||
'vm_id' => $vmId,
|
||||
'server_name' => $serverName,
|
||||
'status' => 'active',
|
||||
'auto_renew' => false,
|
||||
'started_at' => now(),
|
||||
'expires_at' => $this->item->months > 0
|
||||
? now()->addMonths($this->item->months)
|
||||
: null,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
Log::error('❌ Lỗi khi lưu dữ liệu VM và IP address: ' . $e->getMessage(), [
|
||||
'vmware_id' => $vmId,
|
||||
|
||||
Reference in New Issue
Block a user