coolify/app/Notifications/Channels/SlackChannel.php

23 lines
528 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();
2024-12-06 13:33:22 +00:00
if (! $webhookUrl) {
2024-11-12 21:37:55 +00:00
return;
}
2024-12-06 13:33:22 +00:00
SendMessageToSlackJob::dispatch($message, $webhookUrl);
2024-11-12 21:37:55 +00:00
}
2024-12-06 13:33:22 +00:00
}