获取产品名称

This commit is contained in:
Edward Yang 2022-07-18 17:05:44 +08:00
parent 532b286b8c
commit 9eac191b3a
1 changed files with 3 additions and 5 deletions

View File

@ -140,13 +140,11 @@ class ProductRepo
->whereIn('id', $productIds)
->get();
$items = [];
foreach ($products as $product) {
$items[] = [
return $products->map(function ($product) {
return [
'id' => $product->id,
'name' => $product->description->name ?? ''
];
}
return $items;
})->toArray();
}
}