📜  laravel 按日期计数 - PHP 代码示例

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

代码示例1
$usersData = User::select(DB::raw('DATE(created_at) as date'), DB::raw('count(*) as total'))
            ->groupBy('date')
            ->orderBy('date', 'desc')
            ->take(7)
            ->get();