46 lines
956 B
PHP
46 lines
956 B
PHP
<?php
|
|
|
|
namespace App\Notifications\Channels;
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
use App\Models\Echomail;
|
|
use App\Models\Setup;
|
|
|
|
class EchomailChannel
|
|
{
|
|
private const LOGKEY = 'CN-';
|
|
|
|
/**
|
|
* @var Echomail
|
|
*/
|
|
protected Echomail $echomail;
|
|
|
|
/**
|
|
* Create a new Netmail channel instance.
|
|
*
|
|
* @param Echomail $o
|
|
*/
|
|
public function __construct(Echomail $o)
|
|
{
|
|
$this->echomail = $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 (! $echoarea = $notifiable->routeNotificationFor('echomail',$notification))
|
|
return;
|
|
|
|
$o = $notification->toEchomail($notifiable);
|
|
|
|
Log::info(sprintf('%s:= Posted echomail (%d) [%s] to [%s]',self::LOGKEY,$o->id,$o->msgid,$echoarea->name));
|
|
}
|
|
} |