File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments