diff --git a/packages/Sarga/Shop/src/Repositories/ProductRepository.php b/packages/Sarga/Shop/src/Repositories/ProductRepository.php index 328e02a..fea3015 100644 --- a/packages/Sarga/Shop/src/Repositories/ProductRepository.php +++ b/packages/Sarga/Shop/src/Repositories/ProductRepository.php @@ -54,20 +54,18 @@ class ProductRepository extends WProductRepository parent::__construct($attributeRepository, $app); } + /** * @param string $categoryId * * @return \Illuminate\Support\Collection */ - - public function getProductsRelatedToCategoryNurgul($product = null, $limit) + public function getProductsRelatedToCategoryNurgul($categoryId = null, $limit) { $qb = $this->model->leftJoin('product_categories', 'products.id', '=', 'product_categories.product_id'); - $product = $this->find($product); - - if (count($product->categories)) { - $qb->where('product_categories.category_id', $product->categories->first()->id); + if ($categoryId) { + $qb->where('product_categories.category_id', $categoryId); } return $qb->paginate($limit);