clrghouz/app/Notifications/Netmails/Test.php

50 lines
1.1 KiB
PHP
Raw Normal View History

<?php
namespace App\Notifications\Netmails;
use Illuminate\Support\Facades\Log;
use App\Notifications\Netmails;
use App\Models\{Netmail,System};
use App\Traits\PageTemplate;
class Test extends Netmails
{
use PageTemplate;
private const LOGKEY = 'NNT';
/**
* Get the mail representation of the notification.
*
* @param System $so
* @param mixed $notifiable
* @return Netmail
* @throws \Exception
*/
public function toNetmail(System $so,object $notifiable): Netmail
{
$o = $this->setupNetmail($so,$notifiable);
$ao = $notifiable->routeNotificationFor(static::via);
Log::info(sprintf('%s:+ Creating test netmail to [%s]',self::LOGKEY,$ao->ftn));
$o->subject = 'Testing 1, 2, 3...';
// Message
$msg = $this->page(TRUE,'Test');
$msg->addText(
"Hi there,\r\r".
"This is just a test netmail to make sure we can send a message to your system.\r\r".
"There is no need to reply, but if you do, it'll boost my spirits :)\r"
);
$o->msg = $msg->render();
$o->tagline = 'Testing, testing, 1 2 3.';
$o->save();
return $o;
}
}