mirror of
https://github.com/bdnugget/speedtest-tracker.git
synced 2026-11-07 08:37:27 +00:00
47 lines
958 B
PHP
47 lines
958 B
PHP
<?php
|
|
|
|
namespace App\Telegram;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Notification;
|
|
use NotificationChannels\Telegram\TelegramMessage;
|
|
|
|
class TelegramNotification extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
protected $message;
|
|
|
|
/**
|
|
* Create a new notification instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($message)
|
|
{
|
|
$this->message = $message;
|
|
}
|
|
|
|
/**
|
|
* Get the notification's delivery channels.
|
|
*
|
|
* @param mixed $notifiable
|
|
*/
|
|
public function via($notifiable): array
|
|
{
|
|
return ['telegram'];
|
|
}
|
|
|
|
/**
|
|
* Get the Telegram message representation of the notification.
|
|
*
|
|
* @param mixed $notifiable
|
|
*/
|
|
public function toTelegram($notifiable): TelegramMessage
|
|
{
|
|
return TelegramMessage::create()
|
|
->to($notifiable->routes['telegram_chat_id'])
|
|
->content($this->message);
|
|
}
|
|
}
|