Fix date for graph, problem introduced in 3f5668

This commit is contained in:
Deon George 2024-06-18 20:12:36 +09:30
parent ef2e208fde
commit c9700fbd0c
2 changed files with 4 additions and 3 deletions

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Gate;
@ -14,7 +15,7 @@ class DomainController extends Controller
/**
* Daily stats as shown on the about page
*
* @param Domain $o
* @param Request $request
* @return Collection
*/
public function api_daily_stats(Request $request): Collection
@ -25,7 +26,7 @@ class DomainController extends Controller
->sortBy('date')
->groupBy('date')
->transform(function($item,$key) { return [
'x'=>\Carbon\Carbon::createFromFormat('Y-m-d',$key)->timestamp,
'x'=>Carbon::createFromFormat('Y-m-d',$key)->timestamp*1000,
'y'=>$item->sum('count')]; } )
->values();
}

View File

@ -338,7 +338,7 @@
'name'=>$key,
'dashStyle'=>'ShortDot',
'visible'=>$item->first()->show,
'data'=>$item->map(function($item) { return ['x'=>\Carbon\Carbon::createFromFormat('Y-m-d',$item->date)->timestamp,'y'=>$item->count]; })
'data'=>$item->map(function($item) { return ['x'=>\Carbon\Carbon::createFromFormat('Y-m-d',$item->date)->timestamp*1000,'y'=>$item->count]; })
]; })
->values() !!}
});