程序员777 / laravel_mobizon
Laravel的Mobizon通知渠道
0.1.2
2018-04-29 13:56 UTC
Requires
- php: >=5.6.4
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
- illuminate/notifications: 5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*
- illuminate/queue: 5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*
- illuminate/support: 5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.5.*|5.6.*
- mobizon/mobizon-php: 1.0.*
Requires (Dev)
- mockery/mockery: ^0.9.5
- phpunit/phpunit: ^5.2
This package is not auto-updated.
Last update: 2024-09-24 03:56:30 UTC
README
此包简化了使用mobizon.kz通过Laravel发送通知的过程。
安装
您可以通过composer安装此包
composer require aizhar777/laravel_mobizon
发布配置
php artisan vendor:publish --provider="Aizhar777\Mobizon\MobizonServiceProvider"
然后您必须安装服务提供者
// config/app.php 'providers' => [ ... Aizhar777\Mobizon\MobizonServiceProvider::class, ],
在配置中安装您的API密钥
// config/mobizon.php return [ 'alphaname' => null, 'secret' => 'Your secret API key', ];
用法
您可以在通知中的via()
方法中使用此通道
use Illuminate\Notifications\Notification; use Aizhar777\Mobizon\MobizonMessage; use Aizhar777\Mobizon\MobizonChanel; class AccountApproved extends Notification { public function via($notifiable) { return [MobizonChanel::class]; } public function toMobizon($notifiable) { return MobizonMessage::create("Task #{$notifiable->id} is complete!"); } }
在您的可通知模型中,确保包含一个routeNotificationForMobizon()方法,该方法返回电话号码。
public function routeNotificationForMobizon() { return $this->phone; }