coolify/app/Notifications/Channels/SlackChannel.php

22 lines
547 B
PHP
Raw Normal View History

2024-11-12 21:37:55 +00:00
<?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');
}
}