samedi 1 février 2020

Eloququent: relationship from relationship

Have three tables / models:

Clients:

id - client

Brands:

id - brand

BrandModels:

id - model - brand_id

BrandModelClients:

id - brandmodel_id - client_id

I would like to get a "group by" clients list based on the brands in the cleanest way. Right now, I'm doing it in a dirty way.

So the point is that if I have a client who has three different cars of the same brand, get just one client element.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire