Simplified webhook channel implementation to match TelegramChannel pattern without typed interface. Changes: - Removed SendsWebhook interface file - Removed interface from Team model - Removed routeNotificationForWebhook() method - WebhookChannel now uses untyped $notifiable like TelegramChannel 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
37 lines
997 B
PHP
37 lines
997 B
PHP
<?php
|
|
|
|
namespace App\Notifications\Channels;
|
|
|
|
use App\Jobs\SendWebhookJob;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class WebhookChannel
|
|
{
|
|
/**
|
|
* Send the given notification.
|
|
*/
|
|
public function send($notifiable, Notification $notification): void
|
|
{
|
|
$webhookSettings = $notifiable->webhookNotificationSettings;
|
|
|
|
if (! $webhookSettings || ! $webhookSettings->isEnabled() || ! $webhookSettings->webhook_url) {
|
|
if (isDev()) {
|
|
ray('Webhook notification skipped - not enabled or no URL configured');
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
$payload = $notification->toWebhook();
|
|
|
|
if (isDev()) {
|
|
ray('Dispatching webhook notification', [
|
|
'notification' => get_class($notification),
|
|
'url' => $webhookSettings->webhook_url,
|
|
'payload' => $payload,
|
|
]);
|
|
}
|
|
|
|
SendWebhookJob::dispatch($payload, $webhookSettings->webhook_url);
|
|
}
|
|
}
|