yish / sybase-notification-channel
此包已被弃用且不再维护。未建议替代包。
使用 Laravel 的 Sybase 365 通知通道。
1.1.1
2020-09-09 05:03 UTC
Requires
- php: ^7.1
- guzzlehttp/guzzle: ^6.3
- illuminate/notifications: ^5.8|^6.0|^7.0|^8.0
- illuminate/support: 5.8.*|^6.0|^7.0|^8.0
Requires (Dev)
- orchestra/testbench: 3.8.*
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2021-02-15 16:37:26 UTC
README
使用 Laravel 的 Sybase 365 通知通道。
安装
您可以通过 composer 安装此包
composer require yish/sybase-notification-channel
使用方法
创建通知
$ php artisan make:notification SendMessage
通知服务和发送请求
基本
Notification::route('sybase', $phone)->notify(new \App\Notifications\SendMessage);
或者您也可以构造属性
Notification::route('sybase', $phone) ->notify(new \App\Notifications\SendMessage( "Hi, here is yours", "this is content." ));
接下来,导航到 App\Notifications\SendMessage.php,设置驱动程序
use Yish\Notifications\Messages\SybaseMessage; class SendMessage extends Notification { use Queueable; public $subject; public $content; public function __construct($subject, $content) { $this->subject = $subject; $this->content = $content; } public function via($notifiable) { return ['sybase']; } public function toSybase($notifiable) { return (new SybaseMessage) ->subject($this->subject) ->content($this->content); } ....
最后,您必须设置服务账户和密码,在您的 config/services.php 中添加一些配置选项
'sybase' => [ 'account' => env('SYBASE_ACCOUNT'), 'password' => env('SYBASE_PASSWORD'), 'endpoint' => env('SYBASE_ENDPOINT'), ],
高级
在某些情况下,您可能想要自定义接收者或自动发送
<?php namespace App; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; class Guest extends Authenticatable { use Notifiable; public function routeNotificationForSybase($notification) { return $this->mobile; } }
最后,您可以使用
$guest->notify(new SendMessage('Hello', 'world'));
安全
如果您发现任何安全相关的问题,请通过电子邮件 mombuartworks@gmail.com 联系我们,而不是使用问题跟踪器。
致谢
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件。