laravel-notification-channels / twilio

Twilio notifications channel for Laravel
https://laravel-notification-channels.com
227 stars 36 forks source link

Enable overriding the Twilio message source #142

Open misenhower opened 1 year ago

misenhower commented 1 year ago

Hey there. This PR adds a new overridable getMessage() method to TwilioChannel. This makes it a lot easier to use a notification method named something other than toTwilio when subclassing TwilioChannel.

Background: I need to send both SMS and voice messages from a single notification (similar to #97). This PR would make it a lot easier for me to create e.g. a TwilioSmsChannel class that calls ->toTwilioSms() on the notification, and a TwilioVoiceChannel class that calls ->toTwilioVoice(). That way I'll be able to use both TwilioSmsChannel and TwilioVoiceChannel in the same notification class.

I wanted to keep this PR simple, but let me know if you want me to add these TwilioSmsChannel/TwilioVoiceChannel classes here as well.

Thanks!!

misenhower commented 1 year ago

Hey @atymic! Just a friendly ping for this one 😃 Would love to get this merged if possible!

masterbater commented 7 months ago

Would like this to get merge, but copying the class and renaming the class seem work ok.