Hello, I don't deal with cache, but I'm quite good in dealing with databases.
{{ count($expedition->subject) }} is really a bad solution, because $expedition->subject retrieves all the subjects, and count() counts them afterwards. Instead you should ask the database to count that subjects.
{{ $expedition->subjects->count() }}
This is in case that the relations name is 'subjects' instead of 'subject'. I can help you with eager loading, if you need.
@Firtzberg - Thanks for the reply. I actually found the solution here: http://laravel.io/forum/05-03-2014-eloquent-get-count-relation
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community