Suppose I have 4 tables: collections
, venues
, locations
and cities
.
A Collection
belongs to many Venues
and a Venue
belong to many Collections
.
There is a one to one relationship between a Venue
and a Location
(through id
field)
A Location
Belongs to a City
and a City
has many Locations
.
What I want to achieve is this scenario:
if I have a record's id
on cities
table, I want to get all collections
and venues
in each collection
associated with id
on cities
table.
How would I achieve this?
I tried to be as specific as possible,but if something is still vague mention.
I'm using Laravel. so if you provide in Eloquent I would be grateful but SQL query is ok too.