related
This commit is contained in:
parent
09faddcc48
commit
96f9b6a25a
|
|
@ -76,9 +76,9 @@ class Products extends ProductController
|
|||
}
|
||||
}
|
||||
|
||||
public function getCurrentProduct(ProductWebkulRep $prodRep, $id)
|
||||
public function getCurrentProduct(ProductRepository $prodRep, $id)
|
||||
{
|
||||
return ProductResource::collection($prodRep->getProductsRelatedToCategory($id));
|
||||
return ProductResource::collection($prodRep->getProductsRelatedToCategoryNurgul($id, request('perPage')));
|
||||
}
|
||||
|
||||
public function home(SliderRepository $sliderRepository)
|
||||
|
|
|
|||
|
|
@ -60,6 +60,17 @@ class ProductRepository extends WProductRepository
|
|||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
||||
public function getProductsRelatedToCategoryNurgul($categoryId = null, $limit)
|
||||
{
|
||||
$qb = $this->model->leftJoin('product_categories', 'products.id', '=', 'product_categories.product_id');
|
||||
|
||||
if ($categoryId) {
|
||||
$qb->where('product_categories.category_id', $categoryId);
|
||||
}
|
||||
|
||||
return $qb->paginate($limit);
|
||||
}
|
||||
|
||||
public function searchProductByAttributeNurgul($term, $perPage)
|
||||
{
|
||||
$channel = core()->getRequestedChannelCode();
|
||||
|
|
|
|||
Loading…
Reference in New Issue