0
votes

My code is:

$jobs = \App\Job::all()
    ->groupBy(function($item) {
        return $item->created_at->format('M-Y');
    })->paginate(10);

and I am getting the following error :

Call to undefined method Illuminate\Database\Eloquent\Collection::paginate();

1

1 Answers

1
votes

Thus Test:

$jobs = \App\Job::groupBy(function($item) {
    return $item->created_at->format('M-Y');
})->paginate(10);