【发布时间】:2020-08-04 11:50:24
【问题描述】:
我想创建一个图表。使用下面的库。 https://charts.erik.cat/adding_datasets.html#database-eloquent-example-2
动态报告过去 6 个月用户数的查询
(with month rows
Sample:
January = 1,
February = 2,
March = 3
...)
我想要的输出是:
$user_count_chart = [
"2" => 30,
"3" => 41,
"4" => 50,
"5" => 62,
"6" => 72,
"7" => 150,
];
**
- key:月份值
- 值:用户数
**
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('email')->unique();
$table->string('password');
$table->dateTime('email_verified_at')->nullable();
$table->rememberToken();
$table->timestamps();
});
【问题讨论】:
标签: sql laravel eloquent laravel-query-builder