阅读(2567) (7)

Laravel 8 短信通知路由

2021-07-06 09:24:49 更新

要将 Nexmo 通知路由到正确的电话号码,请在可通知实体上定义一个 routeNotificationForNexmo 方法:

<?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * Route notifications for the Nexmo channel.
     *
     * @param  \Illuminate\Notifications\Notification  $notification
     * @return string
     */
    public function routeNotificationForNexmo($notification)
    {
        return $this->phone_number;
    }
}