From 9387ee7dc4e05b0cc1674b1c19b250ae33c8238a Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 17 Apr 2025 14:18:15 +1000 Subject: [PATCH] Additional fixes for 14616471 --- app/Models/Address.php | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/app/Models/Address.php b/app/Models/Address.php index 32aaee2..7fa477f 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -976,14 +976,13 @@ class Address extends Model /** * Echomail waiting to be sent to this address * - * @return Collection + * @return Builder */ - public function echomailWaiting(): Collection + public function echomailWaiting(): Builder { return Echomail::Uncollected() ->where('address_id',$this->id) - ->orderby('id') - ->get(); + ->orderby('id'); } /** @@ -993,22 +992,20 @@ class Address extends Model */ public function echomailWaitingCount(): int { - return Echomail::Uncollected() - ->where('address_id',$this->id) + return $this->echomailWaiting() ->count(); } /** * Files waiting to be sent to this address * - * @return Collection + * @return Builder */ - public function filesWaiting(): Collection + public function filesWaiting(): Builder { return File::Uncollected() ->where('address_id',$this->id) - ->orderby('id') - ->get(); + ->orderby('id'); } /** @@ -1018,8 +1015,7 @@ class Address extends Model */ public function filesWaitingCount(): int { - return File::Uncollected() - ->where('address_id',$this->id) + return $this->filesWaiting() ->count(); } @@ -1169,16 +1165,14 @@ class Address extends Model } /** - * Count of echomail waiting to be sent to this address + * Count of netmail waiting to be sent to this address * * @return int + * @throws \Exception */ public function netmailWaitingCount(): int { - return Netmail::Uncollected() - ->whereIn('tftn_id',$this->downlinks() - ->add($this) - ->pluck('id')) + return $this->netmailWaiting() ->count(); }