Api Laravel via-[';nexmo';]不起作用

Api Laravel via-[';nexmo';]不起作用,api,laravel-5,laravel-5.5,nexmo,Api,Laravel 5,Laravel 5.5,Nexmo,嗨,我正在使用Nexmo API制作laravel短信通知 我已经按照给定的laravel文档和github中的给定集成了nexmo 我下面的代码工作正常 Nexmo::message()->send([ 'to' => 'xxxxxxx', 'from' => 'xxxxxxx', 'text' => 'Using the facade to send a message.' ]); 以上代码正在

嗨,我正在使用Nexmo API制作laravel短信通知

我已经按照给定的laravel文档和github中的给定集成了nexmo

我下面的代码工作正常

     Nexmo::message()->send([
        'to'   => 'xxxxxxx',
        'from' => 'xxxxxxx',
        'text' => 'Using the facade to send a message.'
     ]);
以上代码正在发送短信

我需要将此集成为通知。但不幸的是
return['nexmo']
不起作用。它没有点击通知中的to
toNexmo($notifiable)
方法

有人能帮我吗


谢谢

通过Nexmo发送通知有两种方式-使用内置通知包和使用Nexmo客户端。您已经使用客户端实现了它,但它看起来好像您想要使用通知包,以便它调用
toNexmo

要通过Laravel发送通知,请按如下方式发送:

Notification::send($yourUser,newsomethingNotification())

SomethingNotification
定义如下所示:

<?php

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\NexmoMessage;

class SomethingNotification extends Notification
{
    public function via($notifiable)
    {
        return ['nexmo'];
    }

    public function toNexmo($notifiable)
    {
        return (new NexmoMessage)
            ->content('Some content');
    }
}
您需要在您的用户型号上指定一个
的电话号码: 下一个MO的公共功能路由通知($notification) { 返回$this->电话号码; }
我实现了这一点,但我得到了一个“类”照亮\通知\消息\下一个消息“未找到”fatalthrowable错误…请帮助,谢谢