clrghouz/app/Notifications/Echomails.php
Deon George 35d9e5a5d5
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 1m41s
Create Docker Image / Final Docker Image Manifest (push) Successful in 12s
Automatically mark idle nodes HOLD/DOWN/DE-LIST. Automatically validate presented addresses.
2024-05-25 22:25:57 +10:00

65 lines
1.2 KiB
PHP

<?php
namespace App\Notifications;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use App\Classes\FTN\Message;
use App\Models\{Echoarea,Echomail,Setup};
abstract class Echomails extends Notification //implements ShouldQueue
{
use Queueable;
protected const via = 'echomail';
private const LOGKEY = 'NN-';
/**
* Create a new notification instance.
*/
public function __construct()
{
$this->queue = 'echomail';
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [ self::via ];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return Echomail
* @throws \Exception
*/
abstract public function toEchomail(object $notifiable): Echomail;
protected function setupEchomail(Echoarea $eo): Echomail
{
$o = new Echomail;
$o->from = Setup::PRODUCT_NAME;
$o->echoarea_id = $eo->id;
$o->datetime = Carbon::now();
$o->tzoffset = $o->datetime->utcOffset();
$o->flags = (Message::FLAG_LOCAL);
$o->tearline = sprintf('%s (%04X)',Setup::PRODUCT_NAME,Setup::PRODUCT_ID);
return $o;
}
}