Files
rspade_system/app/Notifications/SystemNotification.php
root f6fac6c4bc Fix bin/publish: copy docs.dist from project root
Fix bin/publish: use correct .env path for rspade_system
Fix bin/publish script: prevent grep exit code 1 from terminating script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 02:08:33 +00:00

95 lines
2.3 KiB
PHP
Executable File

<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class SystemNotification extends Notification implements ShouldQueue
{
use Queueable;
protected $title;
protected $message;
protected $actionUrl;
protected $actionText;
protected $includeGreeting;
/**
* Create a new notification instance.
*
* @param string $title
* @param string $message
* @param string|null $actionUrl
* @param string|null $actionText
* @param bool $includeGreeting
* @return void
*/
public function __construct(
string $title,
string $message,
string $actionUrl = null,
string $actionText = null,
bool $includeGreeting = true
) {
$this->title = $title;
$this->message = $message;
$this->actionUrl = $actionUrl;
$this->actionText = $actionText;
$this->includeGreeting = $includeGreeting;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$mail = (new MailMessage)
->subject($this->title)
->line($this->message);
if ($this->includeGreeting) {
$mail->greeting('Hello ' . $notifiable->name . '!');
}
if ($this->actionUrl && $this->actionText) {
$mail->action($this->actionText, $this->actionUrl);
}
$mail->line('Thank you for using DMR Bridge!');
return $mail;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'title' => $this->title,
'message' => $this->message,
'action_url' => $this->actionUrl,
'action_text' => $this->actionText,
];
}
}