Skip to content

Commit ed31e8d

Browse files
authored
Revise readme to correct class names.
1 parent f998d37 commit ed31e8d

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

README.md

+27-16
Original file line numberDiff line numberDiff line change
@@ -79,47 +79,58 @@ Here's a screenshot preview of the above notification on Telegram Messenger:
7979

8080
### Attach a Photo
8181

82-
``` php
83-
...
82+
```php
8483
public function toTelegram($notifiable)
8584
{
8685
$url = url('/file/' . $this->file->id);
8786

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.
9190
->file('/storage/archive/6029014.jpg', 'photo') // local photo
9291
// OR
9392
// ->file('https://pisces.bbystatic.com/image2/BestBuy_US/images/products/6029/6029014_rd.jpg', 'photo') // remote photo
9493
->button('Download PDF', $url); // Inline Button
9594
}
96-
...
9795
```
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)
100100

101101

102102
### Attach a Document
103103

104-
``` php
105-
...
104+
```php
106105
public function toTelegram($notifiable)
107106
{
108107
$url = url('/file/' . $this->file->id);
109108

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.
113112
->file('/storage/archive/file.pdf', 'document') // local file
114113
// OR
115114
// ->file('http://www.domain.com/file.pdf', 'document') // remote file
116115
->button('Download PDF', $url); // Inline Button
117116
}
118-
...
119117
```
120-
Sample :
121-
![photo5879686121305255737](https://user-images.githubusercontent.com/785830/46316801-feea1c80-c5dd-11e8-99c2-21d00b165a66.jpg)
122118

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+
```
123134

124135
### Routing a message
125136

0 commit comments

Comments
 (0)