修复品牌页翻页问题

This commit is contained in:
Edward Yang 2022-11-07 09:08:43 +08:00
parent 683145f45a
commit 8cddc5fa5a
3 changed files with 7 additions and 3 deletions

View File

@ -48,7 +48,7 @@ class ProductRepo
public static function getProductsByCategory($categoryId): AnonymousResourceCollection
{
$builder = self::getBuilder(['category_id' => $categoryId, 'active' => 1]);
$products = $builder->with('inCurrentWishlist')->paginate();
$products = $builder->with('inCurrentWishlist')->paginate(20);
return ProductSimple::collection($products);
}

View File

@ -31,7 +31,8 @@ class BrandController extends Controller
$data = [
'brand' => $brand,
'products' => ProductSimple::collection($products)->jsonSerialize(),
'products' => $products,
'products_format' => ProductSimple::collection($products)->jsonSerialize(),
];
return view('brand/info', $data);

View File

@ -7,10 +7,13 @@
<x-shop-breadcrumb type="brand" :value="$brand" />
<div class="row">
@foreach ($products as $product)
@foreach ($products_format as $product)
<div class="col-6 col-md-3">@include('shared.product')</div>
@endforeach
</div>
{{ $products->links('shared/pagination/bootstrap-4') }}
</div>
@endsection