Clean up documentation and infrastructure configuration files, and refine API resources and controllers for products and services.
This commit is contained in:
@@ -38,6 +38,7 @@ class ServiceResource extends JsonResource
|
||||
'description' => $this->description,
|
||||
'thumbnail' => $this->thumbnail ? asset($this->thumbnail) : null,
|
||||
'product_type' => $this->product_type,
|
||||
'page_type' => $this->resolvePageType($this->product_type),
|
||||
'specs' => [
|
||||
'cpu' => (int) $this->cpu,
|
||||
'ram' => (int) $this->ram,
|
||||
@@ -77,4 +78,15 @@ class ServiceResource extends JsonResource
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
private function resolvePageType(?string $productType): string
|
||||
{
|
||||
return match ($productType) {
|
||||
'vps', 'cloud' => 'service_vps',
|
||||
'hosting', 'email', 'ssl' => 'service_hosting',
|
||||
'domain' => 'service_domain',
|
||||
'blog' => 'blog',
|
||||
default => 'service_vps',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user