I have this query using eloquent
$data= \App\Logs::select('id', 'created_at')
->get()
->groupBy(function($val) {
return Carbon::parse($val->created_at)->format('d-M-');
})->toArray();
and it returns this
array:2 [▼
"06-Jul-" => array:1 [▼
0 => array:2 [▼
"id" => 1
"created_at" => "2017-07-06 13:21:15"
]
]
"07-Jul-" => array:3 [▼
0 => array:2 [▼
"id" => 2
"created_at" => "2017-07-07 13:43:23"
]
1 => array:2 [▼
"id" => 3
"created_at" => "2017-07-07 14:18:36"
]
2 => array:2 [▼
"id" => 4
"created_at" => "2017-07-07 14:18:41"
]
]
]
When I would like it to return
"06-Jul-" => "1"
"07-Jul-" => "3"
or something like this I'm not understanding what I'm doing wrong.