WIP
This commit is contained in:
1 parent
d728a3af83
commit
34ad7c43e9
11 files changed
+30
-36
No files matched your search
@@ -30,15 +30,15 @@ public function index(): JsonResponse
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$data = $cartItems->map(fn ($cartItem) => [
|
||||
'id' => $cartItem->id,
|
||||
'user_id' => $cartItem->user_id,
|
||||
'product_id' => $cartItem->product_id,
|
||||
'product_quantity' => $cartItem->product_quantity,
|
||||
'created_at' => $cartItem->created_at,
|
||||
'updated_at' => $cartItem->updated_at,
|
||||
'product' => new ProductResource($cartItem->product),
|
||||
'id' => $cartItem->id,
|
||||
'user_id' => $cartItem->user_id,
|
||||
'product_id' => $cartItem->product_id,
|
||||
'product_quantity' => $cartItem->product_quantity,
|
||||
'created_at' => $cartItem->created_at,
|
||||
'updated_at' => $cartItem->updated_at,
|
||||
'product' => new ProductResource($cartItem->product),
|
||||
])->groupBy(function (array $cartItem) {
|
||||
if (isset($cartItem['product']) && $cartItem['product']->channels->count() > 0) {
|
||||
return $cartItem['product']->channels[0]->slug;
|
||||
@@ -48,7 +48,7 @@ public function index(): JsonResponse
|
||||
});
|
||||
|
||||
return response()->rest(
|
||||
$data,
|
||||
$data,
|
||||
code: 200,
|
||||
message: 'Cart items'
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user