3

I am trying to route my Nexmo notification in Laravel from a field other than phone_number which is what the docs state Nexmo looks for to use. I added this snippet of code from the Laravel docs:

public function routeNotificationForNexmo($notification)
{
    return $this->phone;
}

Because the field in my db is phone. But, when this is run, I get an error that says Type error: Too few arguments to function App\User::routeNotificationForNexmo(). What I don't understand is where I would pass through any data to this, and the Laravel docs don't state anymore about custom routing. So how do I route a Nexmo notification from a field other than phone_number?

develpr
  • 1,296
  • 4
  • 22
  • 42

1 Answers1

1

Try remove the argument inside the routeNotificationForNexmo() function :

public function routeNotificationForNexmo()
{
    return $this->phone;
}
Ghyath Darwish
  • 2,614
  • 4
  • 15
  • 31
  • I had tried that before but was getting a different error, turns out it was due to the format of phone number, not the removing of the argument. – develpr Aug 13 '18 at 18:56