yhshanto / itech-sms-channel
Itech灵活的sms通知通道,适用于laravel。
v2.0.0
2020-09-15 05:13 UTC
Requires
- illuminate/notifications: ^7.0 || ^8.0
This package is auto-updated.
Last update: 2024-09-15 14:27:37 UTC
README
安装
composer require yhshanto/itech-sms-channel
配置
您必须在config/services.php中添加以下代码
'itech' => [ 'sms' => [ 'endpoint' => 'https://api.infobip.com/api/v3/sendsms/plain?user=demo&password=demo&sender=Azzoa&SMSText=[message]&GSM=[to]&type=longSMS' ] ]
[message]
将被原始消息替换,[to]
将被可通知路由替换
在您的通知类中通过via方法添加itech
/** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['itech']; }
也在您的通知类中添加此方法,该方法将返回一个sms字符串
/** * Get the sms representation of the notification. * * @param mixed $notifiable * @return array|MailMessage|\NotificationChannels\Fcm\FcmMessage */ public function toItechSms($notifiable) { return 'Write somthing here'; }
您必须在您的可通知类中拥有phone
属性或routeNotificationForItech
方法(返回有效的电话号码),例如App\User