coolify/app/Notifications/Channels/DiscordChannel.php

23 lines
554 B
PHP
Raw Normal View History

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