Files
coolify/app/Notifications/Channels/DiscordChannel.php
2024-09-30 00:43:35 +02:00

23 lines
544 B
PHP

<?php
namespace App\Notifications\Channels;
use App\Jobs\SendMessageToDiscordJob;
use Illuminate\Notifications\Notification;
class DiscordChannel
{
/**
* Send the given notification.
*/
public function send(SendsDiscord $notifiable, Notification $notification): void
{
$message = $notification->toDiscord();
$webhookUrl = $notifiable->routeNotificationForDiscord();
if (! $webhookUrl) {
return;
}
dispatch(new SendMessageToDiscordJob($message, $webhookUrl));
}
}