On Laravel I'm using fairly simple query in combination with paginate method:
return \DB::table('recipes')
->select('recipes.*', \DB::raw('COUNT(votes.id) AS votes'))
->leftJoin('votes', 'votes.recipe_id', '=', 'recipes.id')
->groupBy('recipes.id')
->where('active', 1)->paginate(2);
It doesn't matter how many items I want to fetch I'm not getting pagination rendered. What it interesting there is that I'm able to access ?page=2 etc. But pagination is not rendering.
Seems groupBy is making some mess there.