mercredi 2 septembre 2015

how do I query this relation with eloquent

I'm using Laravel and eloquent obviously.
I have 4 models and tables.
1 => city 2 => location 3 => venue 4 => tag

now bear with me to describe relationship.
a city has many locations and a location belongs to a city.
a location belongs to a venue and a venue has one location.
a venue belongs to many tags and a tag belongs to many venue (Many to many relationship)

Here are the query I wanna executed.
given A city, how can I filter venues of that city based on tags.
example: for city Austin I wanna get venues that have tag "special".

and Also, how many queries are executed for perform this task.Is it efficient to perform this kind of task with this database model.

I tried to be as explicit as possible but if some parts seems vague for you, please don't hesitate to ask.
thanks



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1Us1YT2
via IFTTT

Aucun commentaire:

Enregistrer un commentaire