How to get the count of groupBy and also the data?
I've tried this one but it only returns the count, without the data.
$data = Model::orderBy('id', 'desc')
->select('status', DB::raw('count(*) as total'))
->groupBy('status')
->get();
Any help would be appreciated,
Thanks