verifiedit/laravel-notification-channel-clicksend

Laravel 的 ClickSend 通知通道

2.2.1 2024-03-18 09:01 UTC

This package is auto-updated.

Last update: 2024-09-18 10:07:01 UTC


README

请参阅此仓库以获取提交通道建议的说明。

贡献的样板仓库

Packagist Version (including pre-releases) Software License PHPUnit tests Standards Total Downloads

此包使得使用 Laravel 5.5+、6.x、7.x、8.x、9.x、10.x 和 11.x 通过 ClickSend 发送通知变得简单。

内容

安装

您可以通过 composer 安装此包

$ composer require verifiedit/laravel-notification-channel-clicksend

设置 ClickSend 服务

将您的 ClickSend 详细信息添加到 .env 文件中

CLICKSEND_DRIVER=clicksend
CLICKSEND_ENABLED=true
CLICKSEND_USERNAME=XYZ
CLICKSEND_APIKEY=XYZ
CLICKSEND_SMS_FROM=XYZ

使用

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

use NotificationChannels\ClickSend\ClickSendChannel;
use NotificationChannels\ClickSend\ClickSendMessage;
use Illuminate\Notifications\Notification;

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

    public function toClickSend($notifiable)
    {
        return (new ClickSendMessage())
            ->setContent("Your {$notifiable->service} account was approved!");
    }
}

为了让您的通知知道您要发送/拨打给哪个电话,通道将查找 Notifiable 模型的 phone_number 属性。如果您想覆盖此行为,请将 routeNotificationForClickSend 方法添加到您的 Notifiable 模型中。

public function routeNotificationForClickSend()
{
    return $this->phone_number;
}

变更日志

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

测试

$ composer test

安全

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

贡献

请参阅CONTRIBUTING以获取详细信息。

致谢

许可

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