2024-10-31 12:53:43 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications\Netmails\Areafix;
|
|
|
|
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
use App\Notifications\Netmails;
|
|
|
|
use App\Models\Netmail;
|
|
|
|
use App\Traits\{MessagePath,PageTemplate};
|
|
|
|
|
|
|
|
class Help extends Netmails
|
|
|
|
{
|
|
|
|
use MessagePath,PageTemplate;
|
|
|
|
|
|
|
|
private const LOGKEY = 'ACH';
|
|
|
|
|
|
|
|
/**
|
2024-11-26 01:23:07 +00:00
|
|
|
* Reply to an areafix HELP commands.
|
2024-10-31 12:53:43 +00:00
|
|
|
*
|
|
|
|
* @param Netmail $mo
|
|
|
|
* @param Collection $commands
|
|
|
|
*/
|
|
|
|
public function __construct(private Netmail $mo,private Collection $commands)
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mail representation of the notification.
|
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
* @return Netmail
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
|
|
|
public function toNetmail(object $notifiable): Netmail
|
|
|
|
{
|
|
|
|
$o = $this->setupNetmail($notifiable);
|
|
|
|
$ao = $notifiable->routeNotificationFor(static::via);
|
|
|
|
|
2024-10-31 23:28:22 +00:00
|
|
|
Log::info(sprintf('%s:+ Responding to areafix for a node [%s] HELP processed',self::LOGKEY,$ao->ftn));
|
2024-10-31 12:53:43 +00:00
|
|
|
|
|
|
|
$o->to = $this->mo->from;
|
|
|
|
$o->replyid = $this->mo->msgid;
|
|
|
|
$o->subject = 'Areafix - Help';
|
|
|
|
|
|
|
|
// Message
|
|
|
|
$msg = $this->page(FALSE,'Areafix');
|
|
|
|
|
|
|
|
$msg->addText("Here are the list of commands available to you:\r\r\r\r");
|
|
|
|
|
|
|
|
foreach ($this->commands as $command) {
|
|
|
|
$msg->addText("$command\r");
|
|
|
|
}
|
|
|
|
|
|
|
|
$o->msg = $msg->render();
|
|
|
|
$o->set_tagline = 'Why did the robot cross the road? The chicken programmed it.';
|
|
|
|
|
|
|
|
$o->save();
|
|
|
|
|
|
|
|
return $o;
|
|
|
|
}
|
|
|
|
}
|