mirror of
https://github.com/alexjustesen/speedtest-tracker.git
synced 2026-06-23 07:30:09 +00:00
49 lines
1005 B
PHP
49 lines
1005 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
|
|
* @return array
|
|
*/
|
|
public function via($notifiable)
|
|
{
|
|
return ['telegram'];
|
|
}
|
|
|
|
/**
|
|
* Get the mail representation of the notification.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
|
*/
|
|
public function toTelegram($notifiable)
|
|
{
|
|
return TelegramMessage::create()
|
|
->to($notifiable->routes['telegram_chat_id'])
|
|
->content($this->message);
|
|
}
|
|
}
|