I have a project where an user can have many platforms. These platforms can have many passwords. Currently I have following database structure:
Im trying to use eager loading to get the following object:
{
"id": 1,
"username": "Keith",
"platforms": [
{
"id": 1,
"name": "Jira",
"passwords": [
{
"id": 1,
"password": "hash"
},
{
"id": 2,
"password": "otherhash"
}
]
},
{
"id": 2,
"name": "Confluence",
"passwords": [
{
"id": 3,
"password": "anotherhash"
},
{
"id": 4,
"password": "anotherone"
}
]
}
]
}
I spent a few hours and couldnt figure out. How could I define the relations to get this structure? Is this possible?