clrghouz/app/Notifications/Channels/NetmailChannel.php

45 lines
908 B
PHP

<?php
namespace App\Notifications\Channels;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Log;
use App\Models\Netmail;
class NetmailChannel
{
private const LOGKEY = 'CNN';
/**
* @var Netmail
*/
protected Netmail $netmail;
/**
* Create a new Netmail channel instance.
*
* @param Netmail $o
*/
public function __construct(Netmail $o)
{
$this->netmail = $o;
}
/**
* Send the given notification.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @return \Psr\Http\Message\ResponseInterface|void
*/
public function send($notifiable,Notification $notification)
{
if (! $ao = $notifiable->routeNotificationFor('netmail',$notification))
return;
$o = $notification->toNetmail($notifiable);
Log::info(sprintf('%s:= Sent netmail (%d) [%s] to [%s]',self::LOGKEY,$o->id,$o->msgid,$ao->ftn));
}
}