First things first, have you dd($show->versions)
to see if it does contain any data?
I already did that. And it contains data. That's what's puzzling.
and the dd says that $show->versions is a collection ?
Sorry, I'd done a var_dump. A dd gives me:
string(1) "1"
Hello. I can't find the error, but I have some tips.
Don't use count($show->versions). count is intended for arrays, not collection. I think count($show->versions) allways returns 1. Use $collection->count() instead.
Make dd($show);
Remove all other eager loaded things to see if it helps (probably not).
Eager loading reduces the number of queries made to the database. This increases performaces. But, if you eager load relations of only one entity, that doesn't reduce the number of queries. Eager loading queries each relation seperate. So, actually, you could remove all that eager loading and if you need something you will get it with a simple $model->relation;
Thanks, Firtzberg.
Well I'm loading those results on their own, not eager loading, and it works just fine.
What would be the reason for that?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community