35 lines
921 B
PHP
35 lines
921 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Api\Client\Service;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class ServiceClientDetailResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
if (!$this->resource) {
|
|
return [];
|
|
}
|
|
|
|
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' => $this->orderItem?->os?->version,
|
|
'group' => $this->orderItem?->os?->os_group?->name,
|
|
],
|
|
];
|
|
}
|
|
}
|