Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions app/Actions/Notifications/SendGotifyTestNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Actions\Notifications;

use Filament\Notifications\Notification;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\WebhookServer\WebhookCall;

class SendGotifyTestNotification
{
use AsAction;

public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add Gotify urls!')
->warning()
->send();

return;
}

foreach ($webhooks as $webhook) {
WebhookCall::create()
->url($webhook['url'])
->payload(['message' => '👋 Testing the Gotify notification channel.'])
->doNotSign()
->dispatch();
}

Notification::make()
->title('Test Gotify notification sent.')
->success()
->send();
}
}
37 changes: 37 additions & 0 deletions app/Actions/Notifications/SendHealthCheckTestNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Actions\Notifications;

use Filament\Notifications\Notification;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\WebhookServer\WebhookCall;

class SendHealthCheckTestNotification
{
use AsAction;

public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add HealthCheck.io urls!')
->warning()
->send();

return;
}

foreach ($webhooks as $webhook) {
WebhookCall::create()
->url($webhook['url'])
->payload(['message' => '👋 Testing the HealthCheck.io notification channel.'])
->doNotSign()
->dispatch();
}

Notification::make()
->title('Test HealthCheck.io notification sent.')
->success()
->send();
}
}
49 changes: 49 additions & 0 deletions app/Actions/Notifications/SendNtfyTestNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace App\Actions\Notifications;

use Filament\Notifications\Notification;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\WebhookServer\WebhookCall;

class SendNtfyTestNotification
{
use AsAction;

public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add ntfy urls!')
->warning()
->send();

return;
}

foreach ($webhooks as $webhook) {
$webhookCall = WebhookCall::create()
->url($webhook['url'])
->payload([
'topic' => $webhook['topic'],
'message' => '👋 Testing the ntfy notification channel.',
])
->doNotSign();

// Only add authentication if username and password are provided
if (! empty($webhook['username']) && ! empty($webhook['password'])) {
$authHeader = 'Basic '.base64_encode($webhook['username'].':'.$webhook['password']);
$webhookCall->withHeaders([
'Authorization' => $authHeader,
]);
}

$webhookCall->dispatch();
}

Notification::make()
->title('Test ntfy notification sent.')
->success()
->send();
}
}
41 changes: 41 additions & 0 deletions app/Actions/Notifications/SendPushoverTestNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace App\Actions\Notifications;

use Filament\Notifications\Notification;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\WebhookServer\WebhookCall;

class SendPushoverTestNotification
{
use AsAction;

public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add Pushover URLs!')
->warning()
->send();

return;
}

foreach ($webhooks as $webhook) {
WebhookCall::create()
->url($webhook['url'])
->payload([
'token' => $webhook['api_token'],
'user' => $webhook['user_key'],
'message' => '👋 Testing the Pushover notification channel.',
])
->doNotSign()
->dispatch();
}

Notification::make()
->title('Test Pushover notification sent.')
->success()
->send();
}
}
37 changes: 37 additions & 0 deletions app/Actions/Notifications/SendSlackTestNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Actions\Notifications;

use Filament\Notifications\Notification;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\WebhookServer\WebhookCall;

class SendSlackTestNotification
{
use AsAction;

public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add Slack URLs!')
->warning()
->send();

return;
}

foreach ($webhooks as $webhook) {
WebhookCall::create()
->url($webhook['url'])
->payload(['text' => '👋 Testing the Slack notification channel.'])
->doNotSign()
->dispatch();
}

Notification::make()
->title('Test Slack notification sent.')
->success()
->send();
}
}
Loading