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.



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

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time