Add query cache, show per echo stats on network page

This commit is contained in:
Deon George
2021-11-26 16:16:33 +11:00
parent 871430edf8
commit be886d9e4b
4 changed files with 1378 additions and 598 deletions

View File

@@ -69,6 +69,21 @@ class Domain extends Model
->values();
}
public function daily_echoarea_stats(Echoarea $o): Collection
{
if (! $this->echoareas->count())
return collect();
$where = ['echoarea_id'=>[$o->id]];
$echostats = Echomail::countGroupBy(['datetime',['datetime'=>'%Y-%m-%d']],$where);
return $echostats
->sortBy(function($item) { return $item->id->datetime; })
->map(function($item) { return ['x'=>Carbon::createFromFormat('Y-m-d',$item->id->datetime)->timestamp*1000,'y'=>$item->count]; })
->values();
}
public function stats(System $o=NULL): Collection
{
if (! $this->echoareas->count())