修复品牌页翻页问题
This commit is contained in:
parent
683145f45a
commit
8cddc5fa5a
|
|
@ -48,7 +48,7 @@ class ProductRepo
|
||||||
public static function getProductsByCategory($categoryId): AnonymousResourceCollection
|
public static function getProductsByCategory($categoryId): AnonymousResourceCollection
|
||||||
{
|
{
|
||||||
$builder = self::getBuilder(['category_id' => $categoryId, 'active' => 1]);
|
$builder = self::getBuilder(['category_id' => $categoryId, 'active' => 1]);
|
||||||
$products = $builder->with('inCurrentWishlist')->paginate();
|
$products = $builder->with('inCurrentWishlist')->paginate(20);
|
||||||
return ProductSimple::collection($products);
|
return ProductSimple::collection($products);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ class BrandController extends Controller
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'brand' => $brand,
|
'brand' => $brand,
|
||||||
'products' => ProductSimple::collection($products)->jsonSerialize(),
|
'products' => $products,
|
||||||
|
'products_format' => ProductSimple::collection($products)->jsonSerialize(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('brand/info', $data);
|
return view('brand/info', $data);
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,13 @@
|
||||||
<x-shop-breadcrumb type="brand" :value="$brand" />
|
<x-shop-breadcrumb type="brand" :value="$brand" />
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@foreach ($products as $product)
|
@foreach ($products_format as $product)
|
||||||
<div class="col-6 col-md-3">@include('shared.product')</div>
|
<div class="col-6 col-md-3">@include('shared.product')</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ $products->links('shared/pagination/bootstrap-4') }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue