2023-05-19 17:01:56 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications\Channels;
|
|
|
|
|
|
|
|
use App\Jobs\SendMessageToDiscordJob;
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
|
|
|
class DiscordChannel
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Send the given notification.
|
|
|
|
*/
|
2023-05-25 16:27:52 +00:00
|
|
|
public function send(SendsDiscord $notifiable, Notification $notification): void
|
2023-05-19 17:01:56 +00:00
|
|
|
{
|
|
|
|
$message = $notification->toDiscord($notifiable);
|
2023-05-25 16:27:52 +00:00
|
|
|
$webhookUrl = $notifiable->routeNotificationForDiscord();
|
2023-05-19 17:01:56 +00:00
|
|
|
dispatch(new SendMessageToDiscordJob($message, $webhookUrl));
|
|
|
|
}
|
|
|
|
}
|