Add query cache, show per echo stats on network page
This commit is contained in:
@@ -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())
|
||||
|
Reference in New Issue
Block a user