This commit is contained in:
parent
d881e4e795
commit
a8a42195ca
|
|
@ -42,7 +42,7 @@ class ProductRepo
|
|||
public static function getProductsByCategory($categoryId): AnonymousResourceCollection
|
||||
{
|
||||
$builder = self::getBuilder(['category_id' => $categoryId]);
|
||||
$products = $builder->get();
|
||||
$products = $builder->with('inCurrentWishlist')->get();
|
||||
$items = ProductList::collection($products);
|
||||
return $items;
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ class ProductRepo
|
|||
public static function getProductsByIds($productIds): AnonymousResourceCollection
|
||||
{
|
||||
$builder = self::getBuilder(['product_ids' => $productIds])->whereHas('master_sku');
|
||||
$products = $builder->get();
|
||||
$products = $builder->with('inCurrentWishlist')->get();
|
||||
return ProductList::collection($products);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class BrandController extends Controller
|
|||
|
||||
public function show(int $id)
|
||||
{
|
||||
$products = BrandRepo::find($id)->products()->paginate(20);
|
||||
$products = BrandRepo::find($id)->products()->with('inCurrentWishlist')->paginate(20);
|
||||
|
||||
$data = [
|
||||
'products' => ProductList::collection($products)->jsonSerialize(),
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class MenusController extends Controller
|
|||
|
||||
public function latestProducts()
|
||||
{
|
||||
$products = ProductRepo::getBuilder()->whereHas('master_sku')->orderByDesc('updated_at')->paginate(40);
|
||||
$products = ProductRepo::getBuilder()->whereHas('master_sku')->with('inCurrentWishlist')->orderByDesc('updated_at')->paginate(40);
|
||||
$data = [
|
||||
'products' => $products,
|
||||
'items' => ProductList::collection($products)->jsonSerialize(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue