vicenterusso/laravel-facilitamovel-channel

Laravel的Facilita Movel通知通道

v1.0.0 2020-12-20 21:16 UTC

This package is auto-updated.

Last update: 2024-09-14 05:39:14 UTC


README

Latest Version on Packagist Software License

本包使得在Laravel 5.5+、6.x、7.x和8.x中使用FacilitaMovel发送通知变得简单。

Facilita Movel通道通知,仅支持简单发送

内容

安装

您可以通过Composer安装此包

$ composer require vicenterusso/laravel-facilitamovel-channel

设置FacilitaMovel服务

配置您的凭证

// config/services.php
...
'facilitamovel' => [
    'login'    => env('FACILITA_MOVEL_LOGIN', 'YOUR ACCOUNT'),
    'password' => env('FACILITA_MOVEL_PASSWORD', 'YOUR PASSWORD')
],
...

用法

现在您可以在Notification类中的via()方法中使用此通道。

use NotificationChannels\FacilitaMovel\FacilitaMovelChannel;
use Illuminate\Notifications\Notification;

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

    public function toFacilitamovel($notifiable)
    {
        return FacilitaMovel::create()
            ->to($notifiable->phone) // your user phone
            ->content('Your invoice has been paid');
    }
}

消息路由

...
/**
 * Route notifications for the FacilitaMovel channel.
 *
 * @return int
 */
public function routeNotificationForFacilitamovel()
{
    return $this->phone;
}
...

可用的消息方法

  • to($phone): (integer) 收件人的电话。
  • content('message'): (string) 短信消息。

安全

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

鸣谢

许可

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