Show only validated addresses with packets for packet:system

This commit is contained in:
Deon George 2024-05-23 16:27:24 +10:00
parent 5fc69067fb
commit 710adad634

View File

@ -26,21 +26,31 @@ class PacketSystem extends Command
/**
* Execute the console command.
*
* @return mixed
* @throws \App\Exceptions\InvalidPacketException
* @return int
* @throws \Exception
*/
public function handle()
{
$ao = Address::findFTN($this->argument('ftn'));
foreach ($ao->system->addresses as $o) {
foreach ($ao->system->addresses->where('validated',TRUE) as $o) {
$pkt = $o->getEchomail();
$this->info(sprintf('System address [%s] has [%d] messages.',$ao->ftn,$pkt?->count()));
$this->info(sprintf('System address [%s] has [%d] echomail messages.',$o->ftn,$pkt?->count()));
if ($pkt) {
foreach ($pkt as $msg)
$this->warn(sprintf('- %s (%s)',$msg->msgid,$msg->id));
}
$pkt = $o->getNetmail();
$this->info(sprintf('System address [%s] has [%d] netmail messages.',$o->ftn,$pkt?->count()));
if ($pkt) {
foreach ($pkt as $msg)
$this->warn(sprintf('- %s (%s)',$msg->msgid,$msg->id));
}
}
return self::SUCCESS;
}
}