clrghouz/app/Notifications/Channels/NetmailChannel.php

45 lines
908 B
PHP
Raw Permalink Normal View History

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