Refactor product relations to use new category_product and channel_product tables
- Updated queries and relationships in various controllers and models to replace `product_has_relations` with `category_product` and `channel_product`. - Adjusted methods in `ProductFilterer`, `FilterParamsController`, and `FilterController` to reflect the new database structure. - Modified seeder to insert data into the new `channel_product` table. - Updated tests to ensure compatibility with the new product relation structure.
This commit is contained in:
@@ -182,9 +182,8 @@ class CategoryRepository
|
||||
])) {
|
||||
$products = $resource->products()->distinct('products.id')->pluck('products.id');
|
||||
|
||||
return $this->queryBuilder->join('product_has_relations', 'categories.id', '=', 'product_has_relations.productable_id')
|
||||
->where('product_has_relations.productable_type', '=', 'category')
|
||||
->whereIntegerInRaw('product_has_relations.product_id', $products)
|
||||
return $this->queryBuilder->join('category_product', 'categories.id', '=', 'category_product.category_id')
|
||||
->whereIntegerInRaw('category_product.product_id', $products)
|
||||
->distinct('categories.id')
|
||||
->get(['id', 'slug', 'name']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user