Toku
How can i Access the data in pivot table in a table filed
Hi i am trying to get the data in the pivot table and i don't know what i am doing wrong i read docs but i didn't see anything like my problem
here's my code Tables\Columns\TextColumn::make('products.pivot.quantity'), for some reason this doesn't return anything but if i remove the pivot here's what i get {"id":1, "name":"orange juice", "description":"orange juice 100%", "picture":"01HYJHYD9MQW9JGV365REH72X7.jpg", "quantity":6, "price":5, "calories":200, "sub_category_id":1, "pivot":{ "cart_id":1, "product_id":1, "quantity":3} }, i want to get the quantity value in the pivot table and i want to show it in my table like what product does the user have in his / her cart and the amount of that product
here's my code Tables\Columns\TextColumn::make('products.pivot.quantity'), for some reason this doesn't return anything but if i remove the pivot here's what i get {"id":1, "name":"orange juice", "description":"orange juice 100%", "picture":"01HYJHYD9MQW9JGV365REH72X7.jpg", "quantity":6, "price":5, "calories":200, "sub_category_id":1, "pivot":{ "cart_id":1, "product_id":1, "quantity":3} }, i want to get the quantity value in the pivot table and i want to show it in my table like what product does the user have in his / her cart and the amount of that product
10 replies