¨4.0.1¨
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Modules\Product\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Product\Entities\Product;
|
||||
use Modules\Category\Entities\Category;
|
||||
@@ -14,9 +15,10 @@ trait ProductSearch
|
||||
/**
|
||||
* Search products for the request.
|
||||
*
|
||||
* @param \Modules\Product\Entities\Product $model
|
||||
* @param \Modules\Product\Filters\ProductFilter $productFilter
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Product $model
|
||||
* @param ProductFilter $productFilter
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function searchProducts(Product $model, ProductFilter $productFilter)
|
||||
{
|
||||
@@ -43,9 +45,10 @@ trait ProductSearch
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
private function getAttributes($productIds)
|
||||
{
|
||||
if (! request()->filled('category') || $this->filteringViaRootCategory()) {
|
||||
if (!request()->filled('category') || $this->filteringViaRootCategory()) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
@@ -57,6 +60,7 @@ trait ProductSearch
|
||||
->get();
|
||||
}
|
||||
|
||||
|
||||
private function filteringViaRootCategory()
|
||||
{
|
||||
return Category::where('slug', request('category'))
|
||||
@@ -64,6 +68,7 @@ trait ProductSearch
|
||||
->isRoot();
|
||||
}
|
||||
|
||||
|
||||
private function getProductsCategoryIds($productIds)
|
||||
{
|
||||
return DB::table('product_categories')
|
||||
|
||||
Reference in New Issue
Block a user