devineonline / smsbroadcast-laravel-notifcation-channel
SMS广播通知通道
8.4
2021-06-16 05:57 UTC
Requires
- php: >=7.3
- devineonline/smsbroadcast: ^8.0
- illuminate/notifications: ^8.0
- illuminate/support: ^8.0
Requires (Dev)
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-09-16 13:12:41 UTC
README
此包通过Laravel 8轻松发送通知,这是对Laravel 8支持的分支,以下是原始信息
它底层使用我的Sms Broadcast PHP包。
内容
安装
使用Composer安装包
composer require laravel-notification-channels/sms-broadcast
将配置添加到您的services.php
配置文件
'smsbroadcast' => [ 'username' => env('SMS_BROADCAST_USERNAME'), 'password' => env('SMS_BROADCAST_PASSWORD'), 'default_sender' => env('SMS_BROADCAST_DEFAULT_SENDER', null), ]
使用方法
您可以在通知内的via()
方法中使用该通道
use Illuminate\Notifications\Notification; use NotificationChannels\SmsBroadcast\SmsBroadcastMessage; use NotificationChannels\SmsBroadcast\SmsBroadcastChannel; class AccountApproved extends Notification { public function via($notifiable) { return [SmsBroadcastChannel::class]; } public function toSmsbroadcast($notifiable) { return (new SmsBroadcastMessage) ->content("Task #{$notifiable->id} is complete!"); } }
在您的可通知模型中,确保包含一个routeNotificationForSmsbroadcast()
方法,该方法返回一个澳大利亚电话号码。
public function routeNotificationForSmsbroadcast() { return $this->phone; // 0412345678 or 6142345678 }
可用方法
sender()
:设置发送者的名称或电话号码。
content()
:设置通知消息的内容。
delay()
:设置延迟,在发送消息之前以分钟为单位。
reference()
:设置短信引用代码。
变更日志
有关最近更改的更多信息,请参阅变更日志。
贡献
有关详细信息,请参阅贡献指南。
致谢
许可协议
MIT许可(MIT)。有关更多信息,请参阅许可文件。