From cfc6af6536d5173056cf7c2a2e3631614e23bee9 Mon Sep 17 00:00:00 2001 From: TL Date: Tue, 26 Jul 2022 16:16:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=9B=BE=E7=89=87=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beike/Admin/Http/Resources/ProductResource.php | 4 +++- beike/Models/Product.php | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/beike/Admin/Http/Resources/ProductResource.php b/beike/Admin/Http/Resources/ProductResource.php index 6ac8357f..8207a0c1 100644 --- a/beike/Admin/Http/Resources/ProductResource.php +++ b/beike/Admin/Http/Resources/ProductResource.php @@ -16,7 +16,9 @@ class ProductResource extends JsonResource { $data = [ 'id' => $this->id, - 'image' => thumbnail($this->image), + 'images' => array_map(function ($image) { + return thumbnail($image); + }, $this->images ?? []), 'name' => $this->description->name ?? '', 'price_formatted' => $this->price_formatted, 'active' => $this->active, diff --git a/beike/Models/Product.php b/beike/Models/Product.php index 0fb04272..62fa5188 100644 --- a/beike/Models/Product.php +++ b/beike/Models/Product.php @@ -16,7 +16,6 @@ class Product extends Base ]; protected $casts = [ 'active' => 'boolean', - 'images' => 'array', 'variables' => 'array', 'images' => 'array', ];