atymic/laravel-notification-channel-sms-broadcast

此包已被弃用且不再维护。作者建议使用 laravel-notification-channels/sms-broadcast 包。

SMS 广播通知通道

1.0.0 2019-07-11 03:12 UTC

This package is auto-updated.

Last update: 2019-10-02 03:30:08 UTC


README

包已迁移

此包已迁移到 https://github.com/laravel-notification-channels/sms-broadcast

请更新您的 composer.json 到新位置。命名空间没有变化,所以您只需替换包即可。

## 旧 README

此包简化了使用 Laravel > 5.6 通过 Sms Broadcast 发送通知的过程。

它底层使用了我的 Sms Broadcast PHP 包

内容

安装

使用 composer 安装包

composer require atymic/laravel-notification-channel-sms-broadcast

将配置添加到您的 services.php 配置文件

'smsbroadcast' => [
    'username' => env('SMS_BROADCAST_USERNAME'),
    'password' => env('SMS_BROADCAST_PASSWORD'),
    'default_sender' => env('SMS_BROADCAST_DEFAULT_SENDER', null),
]

使用

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

use Illuminate\Notifications\Notification;
use NotificationChannels\SmsBroadcast\SmsBroadcastMessage;
use NotificationChannels\SmsBroadcast\SmsBroadcastChannel;

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

    public function toSmsbroadcast($notifiable)
    {
        return (new SmsBroadcastMessage)
            ->content("Task #{$notifiable->id} is complete!");
    }
}

在您的可通知模型中,确保包含一个 routeNotificationForSmsbroadcast() 方法,该方法返回一个澳大利亚电话号码。

public function routeNotificationForSmsbroadcast()
{
    return $this->phone; // 0412345678 or 6142345678
}

可用方法

sender(): 设置发送者的名称或电话号码。

content(): 设置通知消息的内容。

delay(): 设置发送消息前的延迟时间(分钟)

reference(): 设置短信参考代码

变更日志

请参阅 CHANGELOG 获取更多关于最近更改的信息。

贡献

请参阅 CONTRIBUTING 获取详细信息。

致谢

许可证

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