Files
speedtest-tracker/app/Notifications/Telegram/SpeedtestNotification.php
T
Alex Justesen 2c618e2d4e [Chore] Added public dashboard middleware (#1568)
* added public dashboard middleware

* fixed lint issues
2024-06-24 18:25:53 -04:00

45 lines
1.1 KiB
PHP

<?php
namespace App\Notifications\Telegram;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use NotificationChannels\Telegram\TelegramMessage;
class SpeedtestNotification extends Notification implements ShouldQueue
{
use Queueable;
/**
* Create a new notification instance.
*/
public function __construct(
public string $content,
public bool $disableNotification = false,
) {}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $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->content)
->disableNotification($this->disableNotification);
}
}