clrghouz/app/Notifications/Netmails/Areafix.php
Deon George 8fb3a21fcd
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 39s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m51s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Normalise tagline/tearline/origin
2024-06-03 19:09:09 +10:00

64 lines
1.5 KiB
PHP

<?php
namespace App\Notifications\Netmails;
use Illuminate\Support\Facades\Log;
use App\Notifications\Netmails;
use App\Models\Netmail;
use App\Traits\{MessagePath,PageTemplate};
class Areafix extends Netmails
{
use MessagePath,PageTemplate;
private const LOGKEY = 'NAF';
private Netmail $mo;
/**
* Reply to an areafix request.
*
* @param Netmail $mo
*/
public function __construct(Netmail $mo)
{
parent::__construct();
$this->mo = $mo;
}
/**
* 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 with netmail to [%s]',self::LOGKEY,$ao->ftn));
$o->to = $this->mo->from;
$o->replyid = $this->mo->msgid;
$o->subject = 'Areafix 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->set_tagline = 'Why did the robot cross the road? The chicken programmed it.';
$o->save();
return $o;
}
}