Merge pull request 'Remove duplicate products in category view due to the bug with the list of category.' (#11) from fix/duplicate-products-in-category-view into master
Reviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
@@ -13,6 +13,7 @@ final class CategoryController extends BaseController
|
|||||||
{
|
{
|
||||||
$products = Product::with('price')
|
$products = Product::with('price')
|
||||||
->selectRaw('products.*')
|
->selectRaw('products.*')
|
||||||
|
->distinct('products.id')
|
||||||
->fromRaw('products, json_each(products.categories)')
|
->fromRaw('products, json_each(products.categories)')
|
||||||
->whereRaw('json_each.value = ?', [$category])
|
->whereRaw('json_each.value = ?', [$category])
|
||||||
->orderByDesc('starred')
|
->orderByDesc('starred')
|
||||||
|
|||||||
Reference in New Issue
Block a user