|
@@ -38,9 +38,11 @@ class ProductController extends Controller
|
|
|
|
|
|
// 获取分类下的所有产品,并按 is_pinned 排序,然后进行分页
|
|
|
$products = DistProduct::where('category_id', $category->id)
|
|
|
+ ->with('images') // Eager load images
|
|
|
->orderBy('is_pinned', 'desc') // 按 is_pinned 降序排序
|
|
|
->paginate(12);
|
|
|
|
|
|
+
|
|
|
// 渲染模板并传递数据
|
|
|
return $this->liquidRenderer->render('products_categories.liquid', [
|
|
|
'category' => $category, // 分类名称
|