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,



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ZyUiuv
via IFTTT

Aucun commentaire:

Enregistrer un commentaire