I was just wondering if there's a way in laravel to return a count on how many times a record exists with eloquent?
I have two tables: cars and brands.
Cars has de fields: id
, brand_id
. Brands has de fields: id
, name
. Relationship lies on cars.brand_id = brands.id
.
I have red the documents and couldn't find a solution.
Is there a way that I can how many times a brand is used by a car, so that i get the count like this:
Suzuki: 2<br>
Opel: 4 <br>
BMW: 1<br>
etc.
via Koen van de Sande