mirror of
https://github.com/alexjustesen/speedtest-tracker.git
synced 2026-06-23 07:00:08 +00:00
2c618e2d4e
* added public dashboard middleware * fixed lint issues
45 lines
1.1 KiB
PHP
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);
|
|
}
|
|
}
|