49 lines
986 B
PHP
49 lines
986 B
PHP
<?php
|
|
|
|
namespace App\Notifications\Channels;
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
use App\Models\Netmail;
|
|
use App\Jobs\AddressPoll as Job;
|
|
|
|
class NetmailChannel
|
|
{
|
|
private const LOGKEY = 'CN-';
|
|
|
|
/**
|
|
* The HTTP client instance.
|
|
*
|
|
* @var Netmail
|
|
*/
|
|
protected Netmail $netmail;
|
|
|
|
/**
|
|
* Create a new Slack 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);
|
|
|
|
Job::dispatch($ao);
|
|
Log::info(sprintf('%s:Sent netmail [%s] via [%s]',self::LOGKEY,$o->msgid,$ao->ftn));
|
|
}
|
|
} |