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;
|
|
|
|
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
|
2022-03-14 11:28:54 +00:00
|
|
|
* @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);
|
|
|
|
|
|
|
|
Job::dispatch($ao);
|
2022-03-14 11:28:54 +00:00
|
|
|
Log::info(sprintf('%s:Sent netmail [%s] via [%s]',self::LOGKEY,$o->msgid,$ao->ftn));
|
2021-11-26 13:36:57 +00:00
|
|
|
}
|
|
|
|
}
|