商品图片功能

This commit is contained in:
TL 2022-07-26 16:16:51 +08:00
parent 78302f4591
commit cfc6af6536
2 changed files with 3 additions and 2 deletions

View File

@ -16,7 +16,9 @@ class ProductResource extends JsonResource
{ {
$data = [ $data = [
'id' => $this->id, 'id' => $this->id,
'image' => thumbnail($this->image), 'images' => array_map(function ($image) {
return thumbnail($image);
}, $this->images ?? []),
'name' => $this->description->name ?? '', 'name' => $this->description->name ?? '',
'price_formatted' => $this->price_formatted, 'price_formatted' => $this->price_formatted,
'active' => $this->active, 'active' => $this->active,

View File

@ -16,7 +16,6 @@ class Product extends Base
]; ];
protected $casts = [ protected $casts = [
'active' => 'boolean', 'active' => 'boolean',
'images' => 'array',
'variables' => 'array', 'variables' => 'array',
'images' => 'array', 'images' => 'array',
]; ];