2023-07-29 03:17:36 +00:00
< ? php
namespace App\Notifications\Netmails ;
use Carbon\Carbon ;
use Illuminate\Support\Facades\Log ;
use App\Notifications\Netmails ;
2024-05-19 13:28:45 +00:00
use App\Models\ { Echomail , Netmail };
2023-07-29 03:17:36 +00:00
use App\Traits\ { MessagePath , PageTemplate };
class EchoareaNotSubscribed extends Netmails
{
use MessagePath , PageTemplate ;
private const LOGKEY = 'NNW' ;
2024-05-19 13:28:45 +00:00
private Echomail $mo ;
2023-07-29 03:17:36 +00:00
/**
* Send a sysop a message if they write to an area that they hadnt previously subscribed to .
*
2024-05-19 13:28:45 +00:00
* @ param Echomail $mo
2023-07-29 03:17:36 +00:00
*/
2024-05-19 13:28:45 +00:00
public function __construct ( Echomail $mo )
2023-07-29 03:17:36 +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-07-29 03:17:36 +00:00
{
2023-12-18 04:13:16 +00:00
$o = $this -> setupNetmail ( $notifiable );
2023-07-29 03:17:36 +00:00
$ao = $notifiable -> routeNotificationFor ( static :: via );
2024-05-19 13:28:45 +00:00
Log :: info ( sprintf ( '%s:+ Creating ECHOAREA NOT SUBSCRIBED netmail to [%s]' , self :: LOGKEY , $ao -> ftn ));
2023-07-29 03:17:36 +00:00
2024-05-19 13:28:45 +00:00
$o -> subject = 'Echoarea not subscribed - ' . $this -> mo -> echoarea -> name ;
2023-07-29 03:17:36 +00:00
// Message
2024-05-19 13:28:45 +00:00
$msg = $this -> page ( FALSE , 'nosub' );
2023-07-29 03:17:36 +00:00
2024-06-28 13:27:06 +00:00
$msg -> addText ( $this -> sourceSummary ( $this -> mo ) . " \r \r " );
2023-07-29 03:17:36 +00:00
2023-08-05 11:32:45 +00:00
$msg -> addText ( sprintf ( " It appears that you havent been previously subscribed to this echoarea using the address [%s]. \r \r " , $ao -> ftn ));
2023-07-29 03:17:36 +00:00
$msg -> addText ( " Even though your post was accepted, I'm not configured to export any posts to you when others respond, you might like to log in to the web interface and do that. \r \r " );
$msg -> addText ( $this -> message_path ( $this -> mo ));
$o -> msg = $msg -> render ();
2024-06-03 09:08:40 +00:00
$o -> set_tagline = 'Don\'t let your trash become someone else\'s treasure. Feed your shredder.' ;
2023-07-29 03:17:36 +00:00
$o -> save ();
return $o ;
}
}