update
This commit is contained in:
@@ -25,19 +25,15 @@ class ClientResource extends JsonResource
|
||||
'phone' => $this->phone,
|
||||
'address' => $this->address,
|
||||
'city' => $this->city,
|
||||
'ward' => $this->ward,
|
||||
'province' => $this->province,
|
||||
'active_phone' => 1,
|
||||
'active_zalo' => 1,
|
||||
'gender' => $this->gender,
|
||||
'ward' => $this->ward->name,
|
||||
'province' => $this->province->name,
|
||||
'gender' => $this->gender_label,
|
||||
'date' => $this->created_at ? $this->created_at->format('Y-m-d H:i:s') : null,
|
||||
'company' => $this->company ?? '',
|
||||
'mst' => null,
|
||||
'avatar' => $this->avatar,
|
||||
'cmnd_after' => $this->cmnd_after,
|
||||
'cmnd_before' => $this->cmnd_before,
|
||||
'cmnd_active' => (bool) $this->identity_number,
|
||||
'cmnd' => $this->cmnd,
|
||||
'cmnd_after' => $this->front_identity_number,
|
||||
'cmnd_before' => $this->back_identity_number,
|
||||
'cmnd' => $this->identity_number,
|
||||
'fb_link' => null,
|
||||
'active_2fa' => 0,
|
||||
'off_mail_marketing' => $this->off_mail_marketing,
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Api\Service;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ServiceResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'name' => $this->name,
|
||||
'slug' => $this->slug,
|
||||
'short_description' => $this->short_description,
|
||||
'description' => $this->description,
|
||||
'thumbnail' => $this->thumbnail ? asset($this->thumbnail) : null,
|
||||
'product_type' => $this->product_type,
|
||||
'specs' => [
|
||||
'cpu' => $this->cpu,
|
||||
'ram' => $this->ram,
|
||||
'disk' => $this->disk,
|
||||
'bandwidth' => $this->bandwidth,
|
||||
'gpu' => $this->gpu
|
||||
],
|
||||
'stock' => $this->stock,
|
||||
'price' => $this->price,
|
||||
'price_sale' => $this->price_sale,
|
||||
'group' => $this->category->name,
|
||||
'os' => $this->osVersions->groupBy('os_group_id')->map(function ($versions) {
|
||||
$group = $versions->first()->osGroup;
|
||||
return [
|
||||
'name' => $group?->name,
|
||||
'thumbnail' => $group?->thumbnail,
|
||||
'versions' => $versions->map(fn($os) => [
|
||||
'version' => $os->version,
|
||||
'name' => $os->name,
|
||||
])->values(),
|
||||
];
|
||||
})->values(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user