dgvai/laravel-notification-channel-isms

Laravel 通知通道 For iSMS SSLWireless 孟加拉国

1.0.0 2020-06-08 06:04 UTC

This package is auto-updated.

Last update: 2024-09-08 16:14:28 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads composer.lock

此包使得通过 SSL Wireless 公司的 ISMS 批量短信服务(孟加拉国)从 Laravel 5.5+、6.x 和 7.x 发送短信变得容易。

内容

安装

您可以通过 composer 安装此包

composer require dgvai/laravel-notification-channel-isms

设置您的配置

将您的 ISMS 账户凭证添加到您的 config/services.php

// config/services.php
...
'isms' => [
    'token'         =>  env('ISMS_TOKEN'),     // The API-TOKEN generated from ISMS panel
    'sid'           =>  env('ISMS_SID'),       // The SID of your stakeholder
],
...

为了让您的通知知道您要发送到哪个电话,该通道将查找可通知模型的 mobile_number 属性(例如,用户模型)。如果您想覆盖此行为,请将 routeNotificationForISMS 方法添加到您的可通知模型中。

public function routeNotificationForISMS()
{
    return '+1234567890';
}

用法

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

use DGvai\ISMS\ISMS;
use DGvai\ISMS\ISMSChannel;
use Illuminate\Notifications\Notification;

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

    public function toISMS($notifiable)
    {
        return new ISMS('Your order has been placed!');
    }
}

变更日志

请参阅 CHANGELOG 了解最近更改了什么。

许可

MIT 许可证(MIT)。请参阅 许可文件 了解更多信息。