Files
coolify/app/Notifications/Channels/SlackChannel.php
2024-11-12 22:37:55 +01:00

22 lines
547 B
PHP

<?php
namespace App\Notifications\Channels;
use App\Jobs\SendMessageToSlackJob;
use Illuminate\Notifications\Notification;
class SlackChannel
{
/**
* Send the given notification.
*/
public function send(SendsSlack $notifiable, Notification $notification): void
{
$message = $notification->toSlack();
$webhookUrl = $notifiable->routeNotificationForSlack();
if (!$webhookUrl) {
return;
}
dispatch(new SendMessageToSlackJob($message, $webhookUrl))->onQueue('high');
}
}