vendredi 13 janvier 2017

how to use pagination in groupby & orderby clause for fetching records in laravel by year wise

$newsYearCount = news::paginate(5)->groupBy(function($date) {
                      return Carbon::parse($date->created_at)->format('Y'); //
                  });

i want to use order By for above code and also it just group By 5 records, but i want a records like firstly it should group By and then apply pagination.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire