2021-07-30 14:35:52 +00:00
|
|
|
<?php
|
|
|
|
|
2021-09-12 12:14:04 +00:00
|
|
|
namespace App\Classes\FTN\Process\Echomail;
|
2021-07-30 14:35:52 +00:00
|
|
|
|
2023-07-23 07:27:52 +00:00
|
|
|
use Illuminate\Support\Facades\Notification;
|
2021-07-30 14:35:52 +00:00
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
2024-05-17 12:10:54 +00:00
|
|
|
use App\Classes\FTN\Process;
|
|
|
|
use App\Models\{Echomail,Netmail};
|
2023-07-23 07:27:52 +00:00
|
|
|
use App\Notifications\Echomails\Test as TestNotification;
|
2021-07-30 14:35:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Process messages to Test
|
|
|
|
*
|
|
|
|
* @package App\Classes\FTN\Process
|
|
|
|
*/
|
|
|
|
final class Test extends Process
|
|
|
|
{
|
2021-09-06 13:39:32 +00:00
|
|
|
private const LOGKEY = 'RT-';
|
|
|
|
|
2021-07-30 14:35:52 +00:00
|
|
|
private const testing = ['test','testing'];
|
|
|
|
|
2024-05-17 12:10:54 +00:00
|
|
|
public static function handle(Echomail|Netmail $mo): bool
|
2021-07-30 14:35:52 +00:00
|
|
|
{
|
2024-05-17 12:10:54 +00:00
|
|
|
if (! self::canProcess($mo->echoarea)
|
|
|
|
|| (strtolower($mo->to) !== 'all')
|
|
|
|
|| (! in_array(strtolower($mo->subject),self::testing)))
|
2021-07-30 14:35:52 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2024-05-19 13:28:45 +00:00
|
|
|
Log::info(sprintf('%s:- Processing TEST message from (%s) [%s] in [%s]',self::LOGKEY,$mo->from,$mo->fftn->ftn,$mo->echoarea->name));
|
2021-07-30 14:35:52 +00:00
|
|
|
|
2024-05-19 13:28:45 +00:00
|
|
|
Notification::route('echomail',$mo->echoarea->withoutRelations())->notify(new TestNotification($mo));
|
2021-07-30 14:35:52 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|