mo = $mo->withoutRelations(); } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return Netmail * @throws \Exception */ public function toNetmail(object $notifiable): Netmail { $o = $this->setupNetmail($notifiable); $ao = $notifiable->routeNotificationFor(static::via); Log::info(sprintf('%s:+ Responding to areafix for a node [%s] LIST processed',self::LOGKEY,$ao->ftn)); $o->to = $this->mo->from; $o->replyid = $this->mo->msgid; $o->subject = 'Areafix - List'; // Message $msg = $this->page(FALSE,'Areafix'); $msg->addText("Here are the list of available echoareas:\r\r\r\r"); $areas = $ao->domain ->echoareas ->filter(fn($item)=>$item->active && ($item->can_read($ao->security) || $item->can_write($ao->security))); if ($areas->count()) { $msg->addText(sprintf(":---:-%s-:-%s-:-%s-:\r", str_repeat('-',10), str_repeat('-',48), str_repeat('-',4), )); $msg->addText(sprintf(": : %-10s : %-48s : %-4s :\r",'AREA','DESCRIPTION','MSGS')); $msg->addText(sprintf(":---:-%s-:-%s-:-%s-:\r", str_repeat('-',10), str_repeat('-',48), str_repeat('-',4), )); foreach ($areas as $eao) { $msg->addText(sprintf(":%s%s%s: %-10s : %-48s : %4d :\r", ($x=$ao->echoareas->contains($eao)) ? '*' : ' ', (! $x ? '+' : ' '), ($eao->can_read($ao->security) && (! $eao->can_write($ao->security))) ? 'R' : (((! $eao->can_read($ao->security)) && $eao->can_write($ao->security)) ? 'W' : ' '), $eao->name, $eao->description, $eao->messages_count(30), )); } $msg->addText(sprintf(":---:-%s-:-%s-:-%s-:\r", str_repeat('-',10), str_repeat('-',48), str_repeat('-',4), )); $msg->addText("\r'*' = Subscribed, '+' = available, 'R' = read only, 'W' = write only\r"); $msg->addText('(MSGS = Messages in the last month)'); } else { $msg->addText(sprintf('No areas available to you from domain [%s]',$ao->domain->name)); } $o->msg = $msg->render(); $o->set_tagline = 'Why did the robot cross the road? The chicken programmed it.'; $o->save(); return $o; } }