@@ -47,10 +47,6 @@ In your Laravel notifications:
4747* Add the ` TwilioChannel ` to your ` via ` return array value
4848* Build a ` toTwilio ` function that returns a ` TwilioMessage ` object
4949
50- By default, the Twilio Channel will use your notifiable's ` phone_number ` field
51- to send a phone number, which must be in a format such as ` 18884445555 ` . See
52- below how to override this.
53-
5450``` php
5551<?php
5652
@@ -88,9 +84,12 @@ class MyNotification extends Notification implements TwilioNotification {
8884 }
8985```
9086
91- ### Overriding the Notifiable Phone Number Field
9287By default, ` TwilioChannel ` will use your notifiable's ` phone_number ` field
93- to send an SMS message. To override this and use a different field, set the
88+ to send an SMS message, which must be in a format such as ` 8884445555 ` .
89+
90+ ### Overriding the Notifiable Phone Number Field
91+
92+ To override the ` phone_number ` and use a different field, set the
9493` twilioPhoneNumberField ` instance variable in your notifiable class:
9594
9695``` php
@@ -100,9 +99,18 @@ class User extends Authenticatable
10099
101100 //
102101}
102+ ```
103+
104+ ### On-Demand Notifications
105+
106+ If you wish to send an on-demand notification, and not use a ` notifiable ` object
107+ at all, you can do that:
108+
109+ ```
110+ use Illuminate\Support\Facades\Notification;
103111
104- Now if you generate a notification from a `User` object, `TwilioChannel`
105- will use the user's `primary_phone_number` field to send messages.
112+ Notification::route('twilio', '5555555555')
113+ ->notify(new InvoicePaid($invoice));
106114```
107115
108116## Testing
@@ -137,7 +145,7 @@ Please review [our security policy](../../security/policy) on how to report secu
137145
138146## Credits
139147
140- - [ Aaron Krauss] ( https://github.com/thecodeboss )
148+ - [ Aaron Krauss] ( https://github.com/alkrauss48 )
141149- [ All Contributors] ( ../../contributors )
142150
143151## License
0 commit comments