Support the ongoing development of Laravel.io →
posted 11 years ago
Eloquent

Hi

I have two models - node and content. Content belongsTo 'node' and Node hasMany 'content' - all pretty straight forward.

In my blade template I loop through each $node->content - I'd like to display a count of specific content records, i.e

Count only those content records where a specific condition is matched.

?

Last updated 3 years ago.
0

You may want to look at the filtering section from the collections area at:

http://laravel.com/docs/eloquent#collections

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

aireyrf aireyrf Joined 16 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.