商品详情

This commit is contained in:
TL 2022-07-20 11:13:16 +08:00
parent 5fc7893764
commit 46d38c0cce
3 changed files with 3 additions and 2 deletions

View File

@ -17,6 +17,7 @@ class Product extends Model
];
protected $casts = [
'active' => 'boolean',
'variables' => 'array',
];
public function categories()

View File

@ -23,7 +23,7 @@ class ProductDetail extends JsonResource
'description' => $this->description->description ?? '',
'image' => image_resize($this->image),
'category_id' => $this->category_id ?? null,
'variables' => json_decode($this->variables),
'variables' => $this->variables,
'skus' => SkuDetail::collection($this->skus)->jsonSerialize(),
];
}

View File

@ -19,7 +19,7 @@ class SkuDetail extends JsonResource
{
return [
'id' => $this->id,
'variants' => json_decode($this->varians),
'variants' => $this->variants,
'position' => $this->position,
'image' => image_resize($this->image),
'model' => $this->model,