update fix deadcode, security

This commit is contained in:
baodev0
2026-09-28 08:26:29 +07:00
parent 3af59bd9c5
commit 82080b5b84
452 changed files with 4857 additions and 26289 deletions
@@ -1,43 +0,0 @@
<?php
namespace App\Http\Resources\Api\Client\Service;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ServiceClientResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
if (!$this->resource) {
return [];
}
$orderItem = $this->orderItem;
$product = $orderItem?->product;
return [
'uuid' => $this->uuid,
'server_name' => $this->server_name,
'status' => $this->status,
'auto_renew' => $this->auto_renew,
'started_at' => $this->started_at?->toISOString(),
'expires_at' => $this->expires_at?->toISOString(),
'os' => [
'version' => $orderItem?->os?->version,
'group' => $orderItem?->os?->osGroup?->name,
],
'specs' => $product ? [
'cpu' => (int) ($product->cpu ?? 0),
'ram' => (int) ($product->ram ?? 0),
'disk' => (int) ($product->disk ?? 0),
'bandwidth' => (int) ($product->bandwidth ?? 0),
] : null,
];
}
}
@@ -1,55 +0,0 @@
<?php
namespace App\Http\Resources\Api\Service\Order;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ServiceDetailResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'uuid' => $this->uuid,
'service_name' => $this->product?->name ?? $this->server_name,
'server_name' => $this->server_name,
'product_type' => $this->product?->product_type,
'billing_cycle' => $this->orderItem?->billing_cycle,
'status' => $this->status,
'status_text' => $this->status_label,
'auto_renew' => (bool) $this->auto_renew,
'started_at' => $this->started_at?->toISOString(),
'expires_at' => $this->expires_at?->toISOString(),
'note' => $this->note,
'invoice_id' => $this->invoice_id,
'invoice_number' => $this->invoice?->invoice_number,
'product' => $this->whenLoaded('product', fn () => [
'id' => $this->product->id,
'uuid' => $this->product->uuid,
'name' => $this->product->name,
'product_type' => $this->product->product_type,
'specs' => [
'cpu' => $this->product->cpu,
'ram' => $this->product->ram,
'disk' => $this->product->disk,
'bandwidth' => $this->product->bandwidth,
],
]),
'addons' => $this->whenLoaded('addons', fn () => $this->addons->map(fn ($a) => [
'type' => $a->addon_type,
'value' => $a->addon_value,
'price' => $a->price,
])->all()),
'vmware' => $this->whenLoaded('vmware', fn () => $this->vmware ? [
'id' => $this->vmware->id,
'name' => $this->vmware->name,
'hostname' => $this->vmware->hostname,
'ip_address' => $this->vmware->ipAddress?->ip,
'os_name' => $this->vmware->os?->name,
'status' => $this->vmware->status,
'next_due_date' => $this->vmware->next_due_date?->toISOString(),
] : null),
];
}
}