如何查询最近7天的用户注册数据
统计图如图所示:

期望得到的数据格式:
[
{created_at:'2020-7-23',num:0}
{created_at:'2020-7-24',num:0}
{created_at:'2020-7-25',num:0}
{created_at:'2020-7-26',num:0}
{created_at:'2020-7-27',num:3}
{created_at:'2020-7-28',num:0}
{created_at:'2020-7-29',num:0}
]
关于 LearnKu
DB::table('users')->whereBetween('created_at',['2020-7-23','2020-7-29']) ->selectRaw('date(created_at) as date,count(*) as num') ->groupBy('date')->get();