clrghouz/app/Classes/FTN/Process/Echomail/Test.php

36 lines
923 B
PHP

<?php
namespace App\Classes\FTN\Process\Echomail;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\Log;
use App\Classes\FTN\Process;
use App\Models\{Echomail,Netmail};
use App\Notifications\Echomails\Test as TestNotification;
/**
* Process messages to Test
*
* @package App\Classes\FTN\Process
*/
final class Test extends Process
{
private const LOGKEY = 'RT-';
private const testing = ['test','testing'];
public static function handle(Echomail|Netmail $mo): bool
{
if (! self::canProcess($mo->echoarea)
|| (strtolower($mo->to) !== 'all')
|| (! in_array(strtolower($mo->subject),self::testing)))
return FALSE;
Log::info(sprintf('%s:- Processing TEST message from (%s) [%s] in [%s]',self::LOGKEY,$mo->from,$mo->fftn->ftn,$mo->echoarea->name));
Notification::route('echomail',$mo->echoarea->withoutRelations())->notify(new TestNotification($mo));
return TRUE;
}
}