clrghouz/app/Notifications/Emails/NodeDelisted.php
Deon George f8cb6ccc37
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 38s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m43s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s
Automatically mark idle nodes HOLD/DOWN/DE-LIST. Automatically validate presented addresses.
2024-05-25 22:31:42 +10:00

49 lines
1.4 KiB
PHP

<?php
namespace App\Notifications\Emails;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use App\Models\Address;
class NodeDelisted extends Notification //implements ShouldQueue
{
use Queueable;
/**
* Create a new notification instance.
*/
public function __construct(private Address $ao)
{
}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail(object $notifiable): MailMessage
{
$now = Carbon::now();
return (new MailMessage)
->cc(our_address($this->ao)->system->users->first()->email)
->subject(sprintf('Your system has been DE-LISTED on %s from %s',$now->format('Y-m-d'),$x=$this->ao->zone->domain->name))
->line(sprintf('Your system has been DE-LISTED, because it hasnt polled **%s** since **%s** (%d days).',$x,$this->ao->system->last_session->format('Y-m-d'),$this->ao->system->last_session->diffInDays($now)))
->line('')
->line('If you think this was a mistake, please let me know.')
->line(sprintf('If you think about returning to %s, then reach out and we can get you back online pretty quickly.',$x));
}
}