I'm using laravel and eloquent.
Actually I have problems filtering results from a table based on conditions on another table's attributes.
I have 3 tables:
- venue
-
city
here are the relationships:
acity
has manylocations
and alocation
belongs to acity
.
alocation
belongs to avenue
and avenue
has onelocation
.
I have a city_id
attribute on locations table, which you may figured out from relationships.
The question is simple:
how can I get those venues which belong to a specific city?
the eloquent query I expect looks like this:
$venues=Venue::with('location')->where('location.city_id',$city->getKey());
Of course that's not gonna work, but seems like this is common task and there would be an eloquent command for it.
Thanks!
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1VwTigO
via IFTTT
Aucun commentaire:
Enregistrer un commentaire