yna / laravel-cellact
Laravel 5.3 的 Cellact 通知频道。
1.0.0
2019-08-29 13:43 UTC
Requires
- php: >=7.0.0
- ext-mbstring: *
- illuminate/notifications: ^5.3.0
- illuminate/queue: ^5.3.0
- illuminate/support: ^5.3.0
Requires (Dev)
- mockery/mockery: ^0.9.5
- phpunit/phpunit: ^5.2
This package is not auto-updated.
Last update: 2024-09-21 13:41:33 UTC
README
本包使得使用 Laravel 5.3+ 发送 Cellact 通知变得简单。
安装
您可以通过 composer 安装此包
composer require yna/laravel-cellact
然后您必须安装服务提供者
// config/app.php 'providers' => [ ... Yna\Cellact\CellactServiceProvider::class, ],
设置 Cellact 服务
将您的 Cellact 账户、用户、密码、发件人和公司添加到 config/services.php
// config/services.php ... 'cellact' => [ 'user' => env('CELLACT_USER'), 'password' => env('CELLACT_PASSWORD'), 'company' => env('CELLACT_COMPANY'), 'from' => env('CELLACT_FROM'), ] ...
用法
您可以在通知中的 via()
方法中使用此通道
use Illuminate\Notifications\Notification; use Yna\Cellact\CellactMessage; use Yna\Cellact\CellactChannel; class AccountApproved extends Notification { public function via($notifiable) { return [CellactChannel::class]; } public function toBSms($notifiable) { return CellactMessage::create("Task #{$notifiable->id} is complete!"); } }
在您的可通知模型中,确保包含一个 routeNotificationForPort2sms() 方法,该方法返回电话号码。
public function routeNotificationForCellact() { return $this->phone; }
可用方法
from()
: 设置发送者的姓名或电话号码。
content()
: 设置通知消息的内容。
安全
如果您发现任何与安全相关的问题,请通过电子邮件 security@yna.co.il 联系我们,而不是使用问题跟踪器。
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。