dimanche 13 septembre 2020

retrieve nested eloquent relations items

I have 4 models connected with hasMany relations as below:

Brand -> hasMany -> Categories -> hasMany -> subCategories -> hasMany -> products

I want to retrieve the categories that their subcategories have one or more products.

I tried querying relationship existence with has and/or whereHas but no luck.

Thanx for your advice,



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire