feat: Reorganize database migrations for module snapshots, VMware, and OS groups, and implement customer order creation email notifications.

This commit is contained in:
pbao9
2026-03-12 12:31:52 +07:00
parent 1934be9a19
commit 508d5186db
19 changed files with 350 additions and 195 deletions
+21 -3
View File
@@ -43,17 +43,28 @@ class OrderResource extends JsonResource
'status' => $this->invoice->status,
'date' => $this->invoice->date,
'due_date' => $this->invoice->due_date,
'date_paid' => $this->invoice->date_paid,
'paid_at' => $this->invoice->paid_at,
]),
'amount' => $this->amount,
'total' => $this->total,
'payment_method' => $this->whenLoaded('payment', fn() => $this->payment->name),
'payment_proof' => $this->payment_proof,
'note' => $this->note,
'client_ip' => $this->client_ip,
'status' => $this->status,
'date' => $this->date,
'paid_at' => $this->paid_at,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'vmwares' => $this->whenLoaded('moduleVmwares', fn() => $this->moduleVmwares->map(fn($vm) => [
'id' => $vm->id,
'vmware_id' => $vm->vmware_id,
'name' => $vm->name,
'hostname' => $vm->hostname,
'user' => $vm->user,
'ip' => $vm->ipAddress?->ip,
'os_id' => $vm->os_id,
'status' => $vm->status,
'next_due_date' => $vm->next_due_date,
])),
'order_items' => $this->whenLoaded('orderItems', fn() => $this->orderItems->map(function ($item) {
return [
'id' => $item->id,
@@ -73,6 +84,13 @@ class OrderResource extends JsonResource
'quantity' => $item->quantity,
'server_name' => $item->server_name,
'price' => $item->price,
'service' => $item->service ? [
'id' => $item->service->id,
'vm_id' => $item->service->vm_id,
'status' => $item->service->status,
'started_at' => $item->service->started_at,
'expires_at' => $item->service->expires_at,
] : null,
];
})),
];