Add total messages to domain view, and improve echoarea stats query

This commit is contained in:
2023-07-30 20:14:38 +10:00
parent 61f64c7c75
commit 7ca6fdc195
3 changed files with 29 additions and 20 deletions

View File

@@ -70,7 +70,7 @@ class Echoarea extends Model
/* METHODS */
public function messages_count(int $period): int
public function messages_count(int $period=NULL): int
{
$eo = Echomail::cacheFor(self::CACHE_TIME)
->where('echoarea_id',$this->id);
@@ -87,6 +87,10 @@ class Echoarea extends Model
case 30: // month
$eo->where('datetime','>=',$dt->subMonth());
break;
case NULL: // all
break;
default:
return 0;
}