Add config for ntfy

This commit is contained in:
James Cole
2024-12-09 06:27:37 +01:00
parent c841fa3620
commit 94085ee940
13 changed files with 396 additions and 137 deletions

View File

@@ -28,11 +28,15 @@ use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Ntfy\Message;
use Wijourdil\NtfyNotificationChannel\Channels\NtfyChannel;
//use Illuminate\Notifications\Slack\SlackMessage;
/**
* Class TestNotification
*/
class TestNotificationDiscord extends Notification
class TestNotificationNtfy extends Notification
{
use Queueable;
@@ -61,6 +65,18 @@ class TestNotificationDiscord extends Notification
];
}
public function toNtfy(mixed $notifiable): Message
{
$message = new Message();
$message->topic(config('ntfy-notification-channel.topic'));
$message->title((string)trans('email.admin_test_subject'));
$message->body((string)trans('email.admin_test_message', ['channel' => 'ntfy']));
$message->tags(['white_check_mark', 'ok_hand']);
return $message;
}
/**
* Get the mail representation of the notification.
*
@@ -83,13 +99,6 @@ class TestNotificationDiscord extends Notification
*
*/
public function toSlack($notifiable) {
// since it's an admin notificaiton, grab the URL from fireflyconfig
$url = app('fireflyconfig')->get('discord_webhook_url', '')->data;
return (new SlackMessage())
->content((string)trans('email.admin_test_subject'))
->to($url);
}
/**
@@ -103,6 +112,6 @@ class TestNotificationDiscord extends Notification
*/
public function via($notifiable)
{
return ['slack'];
return [NtfyChannel::class];
}
}