coolify/app/Notifications/Channels/SlackChannel.php

25 lines
628 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
2024-11-12 21:37:55 +00:00
{
$message = $notification->toSlack();
$slackSettings = $notifiable->slackNotificationSettings;
2024-12-09 16:36:32 +00:00
if (! $slackSettings || ! $slackSettings->isEnabled() || ! $slackSettings->slack_webhook_url) {
2024-11-12 21:37:55 +00:00
return;
}
2024-12-09 16:36:32 +00:00
SendMessageToSlackJob::dispatch($message, $slackSettings->slack_webhook_url);
2024-11-12 21:37:55 +00:00
}
2024-12-06 13:33:22 +00:00
}