I have my data like:
data: [,…]
0: {name: "Product One", price: "15000", quantity: 2, attributes: {attr: {name: "weight", value: "35"}},…}
attributes: {attr: {name: "weight", value: "35"}}
conditions: [{name: "blue", value: 0}, {name: "L", value: 0}]
name: "Product One"
price: "15000"
quantity: 2
I need to add id into each array of my data like:
data: [,…]
0: {name: "Product One", price: "15000", quantity: 2, attributes: {attr: {name: "weight", value: "35"}},…}
attributes: {attr: {name: "weight", value: "35"}}
conditions: [{name: "blue", value: 0}, {name: "L", value: 0}]
name: "Product One"
price: "15000"
quantity: 2
id: 10 // added id
Screenshot
Here is how my database looks like:
Code
Currently just getting my cart_data column, need to add column id as well.
$items2 = CartStorage::where('user_id', $user->id)->get();
$items = [];
foreach($items2 as $item){
$items[] = json_decode($item['cart_data']);
}
