mercredi 13 février 2019

Laravel: hasManyThrough relation to get many to many table values

I have a three table relationship like below

Countries -> (has Many)Provinces ->(has Many)Cities

I want to know is there any way in Eloquent to get all countries where 2nd child i.e. city has status=active

I know to find active cities for a single County through hasManyThrough relation helper provided by Eloquent. But i need to retrieve all Countries who even has a single active city.

Note: I don't wanna loop through every country.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire