Eloquent "groupBy' returning only the first of each group
Here is my query:
$pendencies = Payment::groupBy(DB::raw('DATE(created_at)'))
->select('*', DB::raw('count(*) as total'))
->orderBy('created_at', 'DESC');
dd($pendencies->get());
I want to group by date, only the date, not time, so i used the mysql DATE() function to convert the created_at field to date format, but when returning data this is the result: