2023-09-21 05:25:18 +00:00
< ? php
namespace App\Notifications\Netmails ;
use Illuminate\Support\Facades\Log ;
use App\Notifications\Netmails ;
2024-05-19 13:28:45 +00:00
use App\Models\Netmail ;
2023-09-21 05:25:18 +00:00
use App\Traits\ { MessagePath , PageTemplate };
class Areafix extends Netmails
{
use MessagePath , PageTemplate ;
private const LOGKEY = 'NAF' ;
2024-05-19 13:28:45 +00:00
private Netmail $mo ;
2023-09-21 05:25:18 +00:00
/**
* Reply to an areafix request .
*
2024-05-19 13:28:45 +00:00
* @ param Netmail $mo
2023-09-21 05:25:18 +00:00
*/
2024-05-19 13:28:45 +00:00
public function __construct ( Netmail $mo )
2023-09-21 05:25:18 +00:00
{
parent :: __construct ();
$this -> mo = $mo ;
}
/**
* Get the mail representation of the notification .
*
* @ param mixed $notifiable
* @ return Netmail
* @ throws \Exception
*/
2023-12-18 04:13:16 +00:00
public function toNetmail ( object $notifiable ) : Netmail
2023-09-21 05:25:18 +00:00
{
2023-12-18 04:13:16 +00:00
$o = $this -> setupNetmail ( $notifiable );
2023-09-21 05:25:18 +00:00
$ao = $notifiable -> routeNotificationFor ( static :: via );
Log :: info ( sprintf ( '%s:+ Responding to areafix with netmail to [%s]' , self :: LOGKEY , $ao -> ftn ));
2024-05-19 13:28:45 +00:00
$o -> to = $this -> mo -> from ;
2023-09-21 05:25:18 +00:00
$o -> replyid = $this -> mo -> msgid ;
2023-11-17 10:12:08 +00:00
$o -> subject = 'Areafix Reply' ;
2023-09-21 05:25:18 +00:00
// Message
$msg = $this -> page ( FALSE , 'Areafix' );
$msg -> addText ( " Your areafix request has been received, but unfortunately I do not know how to handle areafix messages yet. \r \r " );
$msg -> addText ( sprintf ( " Until then, you may be able to achieve what you want via the web UI. Head over to %s. Feel free to netmail if you need help. \r \r " , config ( 'app.url' )));
$msg -> addText ( $this -> message_path ( $this -> mo ));
$o -> msg = $msg -> render ();
2024-06-03 09:08:40 +00:00
$o -> set_tagline = 'Why did the robot cross the road? The chicken programmed it.' ;
2023-09-21 05:25:18 +00:00
$o -> save ();
return $o ;
}
}