http = $http; $this->sms_url = $sms_url; } /** * Send the given notification. * * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @return void */ public function send($notifiable, Notification $notification) { $message = $notification->toSms($notifiable); $type = $notification->getType(); $message->to($notifiable->routeNotificationFor('sms', $notification)); if (! $message->to) { return; } try { $this->http->post($this->sms_url . 'api/' . $type , [ 'headers' => [ 'x-sms-ir-secure-token'=>self::getToken() ], 'connect_timeout' => 30, 'json' => ['data' => $message->data], ]); } catch (\GuzzleHttp\Exception\ConnectException $e) { report($e); } } }