I have to make this JSON response which every product has colors and each color has many images
[
{
"id": 1,
"name": "shirt",
"descriptions": "lorem epsum",
"colors":[
{
"color_name":"red",
"icon":"1.jpeg",
"images": [
{
"url": "1.png"
},
{
"url": "2.png"
},
{
"url": "3.jpeg"
}
]
},
{
"color_name":"blue",
"icon":"1.png",
"images": [
{
"url": "1.png"
},
{
"url": "2.png"
},
{
"url": "3.png"
}
]
}
]
}
]
How can I make the colors using eloquent relationships?
how many tables and columns with foreign keys should I create?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire