fix chart data (fix #336)
This commit is contained in:
parent
6db0a0adeb
commit
e89b65afdf
|
|
@ -51,16 +51,18 @@ class AdminController extends Controller
|
||||||
|
|
||||||
$oneMonthAgo = Carbon::today()->subMonth();
|
$oneMonthAgo = Carbon::today()->subMonth();
|
||||||
|
|
||||||
$grouping = fn ($field) => fn ($item) => substr($item->$field, 5, 5);
|
$grouping = fn ($field) => fn ($item) => Carbon::parse($item->$field)->isoFormat('l');
|
||||||
$mapping = fn ($item) => count($item);
|
$mapping = fn ($item) => count($item);
|
||||||
$aligning = fn ($data) => fn ($day) => ($data->get($day) ?? 0);
|
$aligning = fn ($data) => fn ($day) => ($data->get($day) ?? 0);
|
||||||
|
|
||||||
|
/** @var Collection */
|
||||||
$userRegistration = User::where('register_at', '>=', $oneMonthAgo)
|
$userRegistration = User::where('register_at', '>=', $oneMonthAgo)
|
||||||
->select('register_at')
|
->select('register_at')
|
||||||
->get()
|
->get()
|
||||||
->groupBy($grouping('register_at'))
|
->groupBy($grouping('register_at'))
|
||||||
->map($mapping);
|
->map($mapping);
|
||||||
|
|
||||||
|
/** @var Collection */
|
||||||
$textureUploads = Texture::where('upload_at', '>=', $oneMonthAgo)
|
$textureUploads = Texture::where('upload_at', '>=', $oneMonthAgo)
|
||||||
->select('upload_at')
|
->select('upload_at')
|
||||||
->get()
|
->get()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user