I have a higher order message in laravel. It looks like this:
$category->scores->each->ratings->where('result.rating', '>=', 3)->count();
A category has scores a score has ratings and a rating has a result.
I want to get the total amount of ratings for every category where >= 3.
With the code I have right now the end result is always 0.
But when I loop over it like this:
@foreach($categories as $category)
@foreach($category->scores as $score)
@foreach($score->ratings->where('result.rating', '>=', 3) as $rating)
{{ $rating->result->result_nl }}
@endforeach
@endforeach
@endforeach
There are 3 rating results.
What is wrong with my higher order message?