📌  相关文章
📜  Laravel Eloquent,按月分组 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:46.987000             🧑  作者: Mango

代码示例1
$model->select(DB::raw('count(id) as `data`'), DB::raw("DATE_FORMAT(created_at, '%m-%Y') new_date"),  DB::raw('YEAR(created_at) year, MONTH(created_at) month'))
->groupby('year','month')
->get();