@@ -79,47 +79,58 @@ Here's a screenshot preview of the above notification on Telegram Messenger:
79
79
80
80
### Attach a Photo
81
81
82
- ``` php
83
- ...
82
+ ``` php
84
83
public function toTelegram($notifiable)
85
84
{
86
85
$url = url('/file/' . $this->file->id);
87
86
88
- return TelegramMessage ::create()
89
- ->to($this->user ->telegram_user_id) // Optional.
90
- ->content(" *bold text* [inline URL](http://www.example.com/)" ) // Markdown supported.
87
+ return TelegramFile ::create()
88
+ ->to($notifiable ->telegram_user_id) // Optional.
89
+ ->content(' *bold text* [inline URL](http://www.example.com/)' ) // Markdown supported.
91
90
->file('/storage/archive/6029014.jpg', 'photo') // local photo
92
91
// OR
93
92
// ->file('https://pisces.bbystatic.com/image2/BestBuy_US/images/products/6029/6029014_rd.jpg', 'photo') // remote photo
94
93
->button('Download PDF', $url); // Inline Button
95
94
}
96
- ...
97
95
```
98
- Sample :
99
- ![ photo5879686121305255739] ( https://user-images.githubusercontent.com/785830/46316802-ff82b300-c5dd-11e8-85c9-58c66ad29895.jpg )
96
+
97
+ Example:
98
+
99
+ ![ Laravel Telegram Photo Notification Example] ( https://user-images.githubusercontent.com/785830/46316802-ff82b300-c5dd-11e8-85c9-58c66ad29895.jpg )
100
100
101
101
102
102
### Attach a Document
103
103
104
- ``` php
105
- ...
104
+ ``` php
106
105
public function toTelegram($notifiable)
107
106
{
108
107
$url = url('/file/' . $this->file->id);
109
108
110
- return TelegramMessage ::create()
111
- ->to($this->user ->telegram_user_id) // Optional.
112
- ->content(" *bold text* [inline URL](http://www.example.com/)" ) // Markdown supported.
109
+ return TelegramFile ::create()
110
+ ->to($notifiable ->telegram_user_id) // Optional.
111
+ ->content(' *bold text* [inline URL](http://www.example.com/)' ) // Markdown supported.
113
112
->file('/storage/archive/file.pdf', 'document') // local file
114
113
// OR
115
114
// ->file('http://www.domain.com/file.pdf', 'document') // remote file
116
115
->button('Download PDF', $url); // Inline Button
117
116
}
118
- ...
119
117
```
120
- Sample :
121
- ![ photo5879686121305255737] ( https://user-images.githubusercontent.com/785830/46316801-feea1c80-c5dd-11e8-99c2-21d00b165a66.jpg )
122
118
119
+ Example:
120
+
121
+ ![ Laravel Telegram Document Notification Example] ( https://user-images.githubusercontent.com/785830/46316801-feea1c80-c5dd-11e8-99c2-21d00b165a66.jpg )
122
+
123
+ ### Attach a Location
124
+
125
+ ``` php
126
+ public function toTelegram($notifiable)
127
+ {
128
+ return TelegramLocation::create()
129
+ ->to($notifiable->telegram_user_id) // Optional.
130
+ ->latitude('40.6892494')
131
+ ->longitude('-74.0466891');
132
+ }
133
+ ```
123
134
124
135
### Routing a message
125
136
0 commit comments