clrghouz/app/Notifications/Channels/NetmailChannel.php

46 lines
918 B
PHP

<?php
namespace App\Notifications\Channels;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Log;
use App\Models\Netmail;
use App\Models\Setup;
class NetmailChannel
{
private const LOGKEY = 'CN-';
/**
* @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 [%s] to [%s]',self::LOGKEY,$o->msgid,$ao->ftn));
}
}