-1👍
if you want a group by then use if before pagination otherwise, it’s not working
$records = Record::where('user_id', $client->id)
->groupBy(\DB::raw('DATE(created_at) = CURDATE()'))
->latest()->paginate()
Source:stackexchange.com