优化品牌页面产品列表读取性能

This commit is contained in:
Edward Yang 2022-08-17 22:15:42 +08:00
parent d387d49da9
commit 2cc9159f94
1 changed files with 8 additions and 1 deletions

View File

@ -20,7 +20,14 @@ class BrandController extends Controller
public function show(int $id)
{
$products = BrandRepo::find($id)->products()->with('inCurrentWishlist')->paginate(20);
$products = BrandRepo::find($id)
->products()
->with([
'master_sku',
'description',
'inCurrentWishlist'
])
->paginate(20);
$data = [
'products' => ProductSimple::collection($products)->jsonSerialize(),