clrghouz/app/Notifications/Netmails/NodeDelisted.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

59 lines
1.7 KiB
PHP

<?php
namespace App\Notifications\Netmails;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Support\Facades\Log;
use App\Classes\FTN\Message;
use App\Notifications\Netmails;
use App\Models\{Address,Netmail};
use App\Traits\PageTemplate;
class NodeDelisted extends Netmails //implements ShouldQueue
{
use Queueable,PageTemplate;
private const LOGKEY = 'NND';
/**
* Create a new notification instance.
*/
public function __construct(private Address $ao)
{
parent::__construct();
}
/**
* Get the mail representation of the notification.
*/
public function toNetmail(object $notifiable): Netmail
{
$now = Carbon::now();
$o = $this->setupNetmail($notifiable);
$ao = $notifiable->routeNotificationFor(static::via);
Log::info(sprintf('%s:+ Sending a NODE MARKED HOLD for address [%s]',self::LOGKEY,$ao->ftn));
$o->subject = sprintf('Your system has been DE-LISTED from %s',$x=$ao->zone->domain->name);
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH);
// Message
$msg = $this->page(TRUE,'delist');
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
->addText(sprintf("Your system has been marked **DE-LISTED**, because it hasnt polled **%s** with address %s since **%s** (%d days).\r",$this->ao->zone->domain->name,$this->ao->ftn4d,$this->ao->system->last_session->format('Y-m-d'),$this->ao->system->last_session->diffInDays($now)))
->addText("\r")
->addText("If you think this was a mistake, please let me know.\r")
->addText(sprintf('If you think about returning to %s, then reach out and we can get you back online pretty quickly.',$x));
$o->msg = $msg->render();
$o->set_tagline = 'You\'ve been DE-LISTED';
$o->save();
return $o;
}
}