2023-07-23 07:27:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications\Channels;
|
|
|
|
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
use App\Models\Echomail;
|
|
|
|
|
|
|
|
class EchomailChannel
|
|
|
|
{
|
2024-06-09 23:19:21 +00:00
|
|
|
private const LOGKEY = 'CNE';
|
2023-07-23 07:27:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var Echomail
|
|
|
|
*/
|
|
|
|
protected Echomail $echomail;
|
|
|
|
|
|
|
|
/**
|
2024-06-09 23:19:21 +00:00
|
|
|
* Create a new Echomail channel instance.
|
2023-07-23 07:27:52 +00:00
|
|
|
*
|
|
|
|
* @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;
|
|
|
|
|
2023-12-18 04:13:16 +00:00
|
|
|
$o = $notification->toEchomail($notifiable);
|
2023-07-23 07:27:52 +00:00
|
|
|
|
2024-05-19 13:28:45 +00:00
|
|
|
Log::info(sprintf('%s:= Posted echomail (%d) [%s] to [%s]',self::LOGKEY,$o->id,$o->msgid,$echoarea->name));
|
2023-07-23 07:27:52 +00:00
|
|
|
}
|
|
|
|
}
|