Skip to content

Commit

Permalink
ProductController save product with images
Browse files Browse the repository at this point in the history
  • Loading branch information
divinrkz committed Mar 11, 2021
1 parent deeede6 commit b2e65b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .rest
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ GET http://localhost:8000/api/products

###

GET http://localhost:8000/api/product-categories/603877d676690000580050b8
DELETE http://localhost:8000/api/products/604a1a48606800004c000ce3

###

Expand All @@ -13,6 +13,8 @@ Content-Type: application/json
{
"name": "product",
"product_sub_category_id": "603885b976690000580050d6",
"description": "This is a product",
"sizes": [23, 2],
"quantity": 4,
"unit_price": 4000
}
1 change: 1 addition & 0 deletions app/Http/Controllers/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public function saveProductImage(Request $request, Product $product): JsonRespon

$image = array('file' => $savedFile->id, 'color' => $color['color']);


$product->push('images', $image);

$product->save();
Expand Down

0 comments on commit b2e65b3

Please sign in to comment.