From 8cddc5fa5a3b42066c837d8c077d656577260923 Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Mon, 7 Nov 2022 09:08:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=93=81=E7=89=8C=E9=A1=B5?= =?UTF-8?q?=E7=BF=BB=E9=A1=B5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beike/Repositories/ProductRepo.php | 2 +- beike/Shop/Http/Controllers/BrandController.php | 3 ++- themes/default/brand/info.blade.php | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/beike/Repositories/ProductRepo.php b/beike/Repositories/ProductRepo.php index 2520cb46..e5173cbc 100644 --- a/beike/Repositories/ProductRepo.php +++ b/beike/Repositories/ProductRepo.php @@ -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); } diff --git a/beike/Shop/Http/Controllers/BrandController.php b/beike/Shop/Http/Controllers/BrandController.php index d115224e..b3b781a1 100644 --- a/beike/Shop/Http/Controllers/BrandController.php +++ b/beike/Shop/Http/Controllers/BrandController.php @@ -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); diff --git a/themes/default/brand/info.blade.php b/themes/default/brand/info.blade.php index 1dc59468..be7e7685 100644 --- a/themes/default/brand/info.blade.php +++ b/themes/default/brand/info.blade.php @@ -7,10 +7,13 @@
- @foreach ($products as $product) + @foreach ($products_format as $product)
@include('shared.product')
@endforeach
+ + {{ $products->links('shared/pagination/bootstrap-4') }} + @endsection