csgt / notification-channel-direkto
通知通道 Direkto。
v6.0.0
2021-04-23 02:56 UTC
Requires
- php: >=8.0.0
README
此包使得通过 Laravel (Laravel >5.4 分支 5.x Laravel >8 分支 6.x) 发送 [Direkto 通知] 变得容易。
内容
安装
您可以通过 composer 安装此包
composer require csgt/notification-channel-direkto
您必须安装服务提供者
// config/app.php 'providers' => [ ... NotificationChannels\Direkto\DirektoProvider::class, ],
设置您的 Direkto 账户
将您的 Direkto Account SID、认证令牌和 From Number(可选)添加到您的 config/services.php
// config/services.php ... 'direkto' => [ 'account_url' => env('DIREKTO_ACCOUNT_URL'), 'account_token' => env('DIREKTO_AUTH_TOKEN'), ], ...
用法
现在您可以在通知内部的 via()
方法中使用此通道
use NotificationChannels\Direkto\DirektoChannel; use NotificationChannels\Direkto\DirektoMessage; use Illuminate\Notifications\Notification; class AccountApproved extends Notification { public function via($notifiable) { return [DirektoChannel::class]; } public function toDirekto($notifiable) { return (new DirektoMessage()) ->content("Your {$notifiable->service} account was approved!"); } }
为了使您的通知知道您要发送/调用哪个电话,该通道将查找 Notifiable 模型的 celular
属性。如果您想覆盖此行为,请将 routeNotificationForDirekto
方法添加到您的 Notifiable 模型中。
public function routeNotificationForDirekto() { return $this->mobile; }
可用的消息方法
DirektoSmsMessage
from('')
:接受一个电话作为通知发送者。content('')
:接受一个字符串值作为通知正文。
变更日志
有关最近更改的更多信息,请参阅 变更日志。
安全
如果您发现任何安全问题,请通过电子邮件 jgalindo@cs.com.gt 反馈,而不是使用问题跟踪器。
贡献
有关详细信息,请参阅 贡献。
致谢
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。