22 lines
547 B
PHP
22 lines
547 B
PHP
|
|
<?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');
|
||
|
|
}
|
||
|
|
}
|