@@ -55,10 +55,10 @@ You will need to [create](https://apps.twitter.com/) a Twitter app in order to u
5555``` php
5656...
5757'twitter' => [
58- 'consumer_key' => getenv ('TWITTER_CONSUMER_KEY'),
59- 'consumer_secret' => getenv ('TWITTER_CONSUMER_SECRET'),
60- 'access_token' => getenv ('TWITTER_ACCESS_TOKEN'),
61- 'access_secret' => getenv ('TWITTER_ACCESS_SECRET')
58+ 'consumer_key' => env ('TWITTER_CONSUMER_KEY'),
59+ 'consumer_secret' => env ('TWITTER_CONSUMER_SECRET'),
60+ 'access_token' => env ('TWITTER_ACCESS_TOKEN'),
61+ 'access_secret' => env ('TWITTER_ACCESS_SECRET')
6262]
6363...
6464```
@@ -89,23 +89,26 @@ class NewsWasPublished extends Notification
8989 return [TwitterChannel::class];
9090 }
9191
92- public function toTwitter($notifiable) {
92+ public function toTwitter($notifiable)
93+ {
9394 return new TwitterStatusUpdate('Laravel notifications are awesome!');
9495 }
9596}
9697```
9798
9899Take a closer look at the ` TwitterStatusUpdate ` object. This is where the magic happens.
99100```` php
100- public function toTwitter($notifiable) {
101+ public function toTwitter($notifiable)
102+ {
101103 return new TwitterStatusUpdate('Laravel notifications are awesome!');
102104}
103105````
104106### Publish Twitter status update with images
105107It is possible to publish images with your status update too. You just have to pass the image path to the ` withImage `
106108method.
107109```` php
108- public function toTwitter($notifiable) {
110+ public function toTwitter($notifiable)
111+ {
109112 return (new TwitterStatusUpdate('Laravel notifications are awesom!'))->withImage('marcel.png');
110113}
111114````
@@ -120,7 +123,8 @@ return (new TwitterStatusUpdate('Laravel notifications are awesom!'))->withImage
120123To send a Twitter direct message to a specific user, you will need the ` TwitterDirectMessage ` class. Provide the Twitter
121124user handler as the first parameter and the the message as the second one.
122125```` php
123- public function toTwitter($notifiable) {
126+ public function toTwitter($notifiable)
127+ {
124128 return new TwitterDirectMessage('marcelpociot', 'Hey Marcel, it was nice meeting you at the Laracon.');
125129}
126130````
0 commit comments