csgt/notification-channel-goip

5.8.0 2019-08-03 01:12 UTC

This package is auto-updated.

Last update: 2024-08-29 04:25:50 UTC


README

Latest Version on Packagist Software License Total Downloads

此包使您能够轻松使用Laravel 5.4发送[Direkto通知]。

内容

安装

您可以通过composer安装此包

composer require csgt/notification-channel-goip

您必须安装服务提供者

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

设置您的Direkto账户

将您的Direkto Account SID、认证令牌和From Number(可选)添加到您的config/services.php

// config/services.php
...
'goip' => [
        'account_url' => env('GOIP_URL'),
    ],
...

使用方法

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

use Illuminate\Notifications\Notification;
use NotificationChannels\GoIP\GoIPChannel;
use NotificationChannels\GoIP\GoIPMessage;

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

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

为了使您的通知知道您要发送/呼叫哪个电话,该通道将查找可通知模型的celular属性。如果您想覆盖此行为,请将routeNotificationForDirekto方法添加到您的可通知模型中。

public function routeNotificationForDirekto()
{
    return $this->mobile;
}

可用的消息方法

GoIPSmsMessage

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

变更日志

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

安全

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

贡献

有关详细信息,请参阅CONTRIBUTING

致谢

许可

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