unicodeveloper/laravel-notification-channel-jusibe

dev-master 2016-12-25 17:16 UTC

This package is auto-updated.

Last update: 2024-09-07 17:46:51 UTC


README

Latest Version on Packagist Software License Build Status Quality Score Total Downloads

此包简化了在 Laravel 5.3 中发送 Jusibe 通知的过程。

注意:请勿使用此包,它已被弃用。新版本和有效版本在此处 => LARAVEL NOTIFICATION CHANNELS - JUSIBE

内容

安装

您可以通过 composer 安装此包

composer require unicodeveloper/laravel-notification-channel-jusibe

您必须安装服务提供者

// config/app.php
'providers' => [
    ...
    NotificationChannels\Jusibe\JusibeServiceProvider::class,
],

设置您的 Jusibe 账户

将您的 Jusibe 账户密钥、访问令牌和发件号码(可选)添加到您的 config/services.php

// config/services.php
...
'jusibe' => [
    'key' => env('JUSIBE_PUBLIC_KEY'),
    'token' => env('JUSIBE_ACCESS_TOKEN'),
    'sms_from' => 'PROSPER'
]
...

使用方法

现在您可以在通知内的 via() 方法中使用此通道

use NotificationChannels\Jusibe\JusibeChannel;
use NotificationChannels\Jusibe\JusibeMessage;
use Illuminate\Notifications\Notification;

class ValentineDateApproved extends Notification
{
    public function via($notifiable)
    {
        return [JusibeChannel::class];
    }

    public function toJusibe($notifiable)
    {
        return (new JusibeMessage())
            ->content("Your {$notifiable->service} account was approved!");
    }
}

为了使您的通知知道您要发送给哪个手机,请将 routeNotificationForJusibe 方法添加到您的 Notifiable 模型中,例如您的 User 模型

public function routeNotificationForJusibe()
{
    return $this->phone; // where `phone` is a field in your users table;
}

可用的消息方法

JusibeMessage

  • from(''):接受一个用于通知发送者的电话。
  • content(''):接受用于通知正文的字符串值。

变更日志

有关最近更改的更多信息,请参阅CHANGELOG

测试

$ composer test

安全

如果您发现任何安全相关的问题,请通过电子邮件prosperotemuyiwa@gmail.com而不是使用问题跟踪器。

贡献

有关详细信息,请参阅CONTRIBUTING

致谢

许可证

MIT 许可证 (MIT)。有关更多信息,请参阅许可证文件