Skip to content

Commit df27276

Browse files
authored
[Bug] added back deleted telegram notification class (alexjustesen#586)
1 parent 52ae05e commit df27276

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace App\Telegram;
4+
5+
use Illuminate\Bus\Queueable;
6+
use Illuminate\Notifications\Notification;
7+
use NotificationChannels\Telegram\TelegramMessage;
8+
9+
class TelegramNotification extends Notification
10+
{
11+
use Queueable;
12+
13+
protected $message;
14+
15+
/**
16+
* Create a new notification instance.
17+
*
18+
* @return void
19+
*/
20+
public function __construct($message)
21+
{
22+
$this->message = $message;
23+
}
24+
25+
/**
26+
* Get the notification's delivery channels.
27+
*
28+
* @param mixed $notifiable
29+
* @return array
30+
*/
31+
public function via($notifiable)
32+
{
33+
return ['telegram'];
34+
}
35+
36+
/**
37+
* Get the mail representation of the notification.
38+
*
39+
* @param mixed $notifiable
40+
* @return \Illuminate\Notifications\Messages\MailMessage
41+
*/
42+
public function toTelegram($notifiable)
43+
{
44+
return TelegramMessage::create()
45+
->to($notifiable->routes['telegram_chat_id'])
46+
->content($this->message);
47+
}
48+
}

0 commit comments

Comments
 (0)