<?php namespace App\Notifications\Netmails; use Illuminate\Support\Facades\Log; use App\Classes\FTN\Message; use App\Notifications\Netmails; use App\Models\{Netmail,System}; use App\Traits\{MessagePath,PageTemplate}; class Areafix extends Netmails { use MessagePath,PageTemplate; private const LOGKEY = 'NAF'; private Message $mo; /** * Reply to an areafix request. * * @param Message $mo */ public function __construct(Message $mo) { parent::__construct(); $this->mo = $mo; } /** * Get the mail representation of the notification. * * @param System $so * @param mixed $notifiable * @return Netmail * @throws \Exception */ public function toNetmail(System $so,object $notifiable): Netmail { $o = $this->setupNetmail($so,$notifiable); $ao = $notifiable->routeNotificationFor(static::via); Log::info(sprintf('%s:+ Responding to areafix with netmail to [%s]',self::LOGKEY,$ao->ftn)); $o->to = $this->mo->user_from; $o->replyid = $this->mo->msgid; $o->subject = 'Ping Reply'; // Message $msg = $this->page(FALSE,'Areafix'); $msg->addText("Your areafix request has been received, but unfortunately I do not know how to handle areafix messages yet.\r\r"); $msg->addText(sprintf("Until then, you may be able to achieve what you want via the web UI. Head over to %s. Feel free to netmail if you need help.\r\r",config('app.url'))); $msg->addText($this->message_path($this->mo)); $o->msg = $msg->render(); $o->tagline = 'Why did the robot cross the road? The chicken programmed it.'; $o->save(); return $o; } }