diff --git a/app/Models/Address.php b/app/Models/Address.php
index 7137df2..4e244e2 100644
--- a/app/Models/Address.php
+++ b/app/Models/Address.php
@@ -453,7 +453,7 @@ class Address extends Model
'node_id',
'point_id',
'system_id',
- DB::raw('count(*) as uncollected_echomail'),
+ DB::raw('count(addresses.id) as uncollected_echomail'),
DB::raw('0 as uncollected_netmail'),
DB::raw('0 as uncollected_files'),
])
@@ -490,7 +490,7 @@ class Address extends Model
'system_id',
DB::raw('0 as uncollected_echomail'),
DB::raw('0 as uncollected_netmail'),
- DB::raw('count(*) as uncollected_files')
+ DB::raw('count(addresses.id) as uncollected_files')
])
->UncollectedFiles();
}
@@ -528,7 +528,7 @@ class Address extends Model
'point_id',
'system_id',
DB::raw('0 as uncollected_echomail'),
- DB::raw('count(*) as uncollected_netmail'),
+ DB::raw('count(addresses.id) as uncollected_netmail'),
DB::raw('0 as uncollected_files')
])
->UncollectedNetmail();
diff --git a/app/Models/Domain.php b/app/Models/Domain.php
index 6ddfcef..4fff481 100644
--- a/app/Models/Domain.php
+++ b/app/Models/Domain.php
@@ -110,7 +110,7 @@ class Domain extends Model
{
return Cache::remember(md5(sprintf('%d-%s',$this->id,$systems?->pluck('id')->join(','))),self::CACHE_TIME,function() use ($systems) {
return DB::query()
- ->select(['echoareas.name','echoareas.show',DB::raw('COUNT(*) AS count'),DB::raw('datetime::date AS date')])
+ ->select(['echoareas.name','echoareas.show',DB::raw('COUNT(echoareas.name) AS count'),DB::raw('datetime::date AS date')])
->from($this->getTable())
->join('echoareas',['echoareas.domain_id'=>'domains.id'])
->join('echomails',['echomails.echoarea_id'=>'echoareas.id'])
diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php
index f8beed0..b5d11ee 100644
--- a/resources/views/system/addedit.blade.php
+++ b/resources/views/system/addedit.blade.php
@@ -1,8 +1,9 @@
-@php
-use App\Models\Address;
-@endphp
-
+@use(App\Models\Address)
+@use(App\Models\Echomail)
+@use(App\Models\File)
+@use(App\Models\Netmail)
+
@extends('layouts.app')
@section('htmlheader_title')
@@ -390,7 +391,7 @@ use App\Models\Address;
The last Netmails sent (to you):
- @if(($x=\App\Models\Netmail::select(['sent_pkt','sent_at',DB::raw('count(*) AS count')])
+ @if(($x=Netmail::select(['sent_pkt','sent_at',DB::raw('count(sent_pkt) AS count')])
->whereIn('sent_id',$o->addresses->pluck('id'))
->whereNotNull('sent_at')
->groupBy(['sent_pkt','sent_at'])
@@ -425,7 +426,7 @@ use App\Models\Address;
The last Echomails sent (to you):
- @if(($x=\App\Models\Echomail::select(['sent_pkt','sent_at',DB::raw('count(*) AS count')])
+ @if(($x=Echomail::select(['sent_pkt','sent_at',DB::raw('count(sent_pkt) AS count')])
->join('echomail_seenby',['echomail_seenby.echomail_id'=>'echomails.id'])
->whereNotNull('sent_at')
->whereIn('address_id',$o->addresses->pluck('id'))
@@ -460,7 +461,7 @@ use App\Models\Address;
The last Files sent (to you):
- @if(($x=\App\Models\File::select(['sent_at',DB::raw('count(*) AS count')])
+ @if(($x=File::select(['sent_at',DB::raw('count(sent_at) AS count')])
->join('file_seenby',['file_seenby.file_id'=>'files.id'])
->whereNotNull('sent_at')
->whereIn('address_id',$o->addresses->pluck('id'))
@@ -495,7 +496,7 @@ use App\Models\Address;
The last Netmails received (you sent):
- @if(($x=\App\Models\Netmail::select(['recv_pkt','recv_at',DB::raw('count(*) AS count')])
+ @if(($x=Netmail::select(['recv_pkt','recv_at',DB::raw('count(recv_pkt) AS count')])
->join('netmail_path',['netmail_path.netmail_id'=>'netmails.id'])
->whereIn('address_id',$o->addresses->pluck('id'))
->groupBy(['recv_pkt','recv_at'])
@@ -529,7 +530,7 @@ use App\Models\Address;
The last Echomails received (you sent):
- @if(($x=\App\Models\Echomail::select(['recv_pkt','recv_at',DB::raw('count(*) AS count')])
+ @if(($x=Echomail::select(['recv_pkt','recv_at',DB::raw('count(recv_pkt) AS count')])
->join('echomail_path',['echomail_path.echomail_id'=>'echomails.id'])
->whereNotNull('recv_pkt')
->whereIn('address_id',$o->addresses->pluck('id'))
@@ -564,7 +565,7 @@ use App\Models\Address;
The last Files received (from you):
- @if(($x=\App\Models\File::select(['created_at',DB::raw('count(*) AS count')])
+ @if(($x=File::select(['created_at',DB::raw('count(created_at) AS count')])
->whereIn('fftn_id',$o->addresses->pluck('id'))
->groupBy(['created_at'])
->orderBy('created_at','DESC')
diff --git a/resources/views/system/view.blade.php b/resources/views/system/view.blade.php
index 2895de7..8b106a0 100644
--- a/resources/views/system/view.blade.php
+++ b/resources/views/system/view.blade.php
@@ -1,4 +1,6 @@
+@use(App\Models\Echoarea)
+
@extends('layouts.app')
@section('htmlheader_title')
Systems
@@ -80,7 +82,7 @@
@foreach($o->addresses->sortBy('zone.domain.name')->groupBy('zone.domain_id') as $did => $domain_addresses)
- @foreach(\App\Models\Echoarea::select([DB::raw('count(echomails.*) as count'),DB::raw('max(echomails.datetime) as most_recent')])
+ @foreach(Echoarea::select([DB::raw('count(echomails.id) as count'),DB::raw('max(echomails.datetime) as most_recent')])
->join('echomails',['echomails.echoarea_id'=>'echoareas.id'])
->join('echomail_seenby',function($join) use ($domain_addresses) {
return $join->on('echomail_seenby.echomail_id','echomails.id')