Merge pull request #498 from jitendra-webkul/jitendra

Refactor product repository
This commit is contained in:
JItendra Singh 2019-01-29 18:40:57 +05:30 committed by GitHub
commit d4c5b2faba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 14 deletions

View File

@ -401,11 +401,11 @@ class ProductRepository extends Repository
* @param integer $categoryId
* @return Collection
*/
public function findAllByCategoryQueryBuilder($categoryId = null)
public function findAllByCategory($categoryId = null)
{
$params = request()->input();
return app('Webkul\Product\Repositories\ProductFlatRepository')->scopeQuery(function($query) use($params, $categoryId) {
$results = app('Webkul\Product\Repositories\ProductFlatRepository')->scopeQuery(function($query) use($params, $categoryId) {
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
$locale = request()->get('locale') ?: app()->getLocale();
@ -466,18 +466,7 @@ class ProductRepository extends Repository
});
return $qb;
});
}
/**
* @param integer $categoryId
* @return Collection
*/
public function findAllByCategory($categoryId = null)
{
$params = request()->input();
$results = $this->findAllByCategoryQueryBuilder($categoryId)->paginate(isset($params['limit']) ? $params['limit'] : 9);
})->paginate(isset($params['limit']) ? $params['limit'] : 9);
return $results;
}