Added in network graph on about screen
This commit is contained in:
@@ -45,7 +45,7 @@ trait UseMongo
|
||||
|
||||
/* METHODS */
|
||||
|
||||
public static function countGroupBy(string $field,array $where=[]): Collection
|
||||
public static function countGroupBy(array $fields,array $where=[]): Collection
|
||||
{
|
||||
$query = collect();
|
||||
|
||||
@@ -64,9 +64,20 @@ trait UseMongo
|
||||
]);
|
||||
}
|
||||
|
||||
$gb = collect();
|
||||
foreach ($fields as $field)
|
||||
if (is_array($field)) {
|
||||
foreach ($field as $k=>$v) {
|
||||
$gb->put('datetime',['$dateToString'=>['format'=>$v,'date'=>'$'.$k]]);
|
||||
}
|
||||
|
||||
} else {
|
||||
$gb->put($field,'$'.$field);
|
||||
}
|
||||
|
||||
$query->push([
|
||||
'$group' => [
|
||||
'_id' => [$field=>'$'.$field],
|
||||
'_id' => $gb->toArray(),
|
||||
'count' => ['$sum' => 1]
|
||||
]
|
||||
]);
|
||||
|
Reference in New Issue
Block a user