withCount is a new method of laravel to return count of the relations. I'm trying to use with and withCount together. For example:
Article::with('Comments')->withCount('Comments')->paginate();
Problem I'm facing is, in the results is see for example:
comments_count = 10
comments = []
It returns comments array null. I don't know is it possible to get both the results or not. In some articles on different sites, i see withCount still has some restrictions. But not sure what I'm trying to do is possible or not.
Please help me to know about this issue.
Thank you,
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire