Answer the question
In order to leave comments, you need to log in
How to build a competent query in the database with related tables?
I thought that I would put the data in the database and it was done, but it wasn’t there - the difficulties were ahead)
I read it four times and tried to implement what was written in the English-language and Russian-language documentation, but this is beyond my understanding.
There are three tables (briefly, without extra fields):
bids
- id
- user_id
users
- id
- auto_id
autos
- id
[
{
id : 1,
user : {
id : 1,
name: 'vanyok',
auto : {
id : 1,
model: 'tesla'
}
}
},
{
id : 2,
user : {
id : 5,
name: 'sanyok',
auto : {
id : 7 ,
model: 'huesla'
}
}
}
]
Answer the question
In order to leave comments, you need to log in
In the context of laravel, it will be something like this: It
remains only to build relationships https://laravel.com/docs/5.5/eloquent-relationship...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question