芝麻web文件管理V1.00
编辑当前文件:/home/sditechnicalteam/www/vendor/laravel-notification-channels/twilio/src/TwilioChannel.php
twilio = $twilio; $this->events = $events; } /** * Send the given notification. * * @param mixed $notifiable * @param Notification $notification * * @return mixed * @throws Exception */ public function send($notifiable, Notification $notification) { try { $to = $this->getTo($notifiable, $notification); $message = $notification->toTwilio($notifiable); $useSender = $this->canReceiveAlphanumericSender($notifiable); if (is_string($message)) { $message = new TwilioSmsMessage($message); } if (! $message instanceof TwilioMessage) { throw CouldNotSendNotification::invalidMessageObject($message); } return $this->twilio->sendMessage($message, $to, $useSender); } catch (Exception $exception) { $event = new NotificationFailed( $notifiable, $notification, 'twilio', ['message' => $exception->getMessage(), 'exception' => $exception] ); $this->events->dispatch($event); if ($this->twilio->config->isIgnoredErrorCode($exception->getCode())) { return; } throw $exception; } } /** * Get the address to send a notification to. * * @param mixed $notifiable * @param Notification|null $notification * * @return mixed * @throws CouldNotSendNotification */ protected function getTo($notifiable, $notification = null) { if ($notifiable->routeNotificationFor(self::class, $notification)) { return $notifiable->routeNotificationFor(self::class, $notification); } if ($notifiable->routeNotificationFor('twilio', $notification)) { return $notifiable->routeNotificationFor('twilio', $notification); } if (isset($notifiable->phone_number)) { return $notifiable->phone_number; } throw CouldNotSendNotification::invalidReceiver(); } /** * Get the alphanumeric sender. * * @param $notifiable * * @return mixed|null * @throws CouldNotSendNotification */ protected function canReceiveAlphanumericSender($notifiable) { return method_exists($notifiable, 'canReceiveAlphanumericSender') && $notifiable->canReceiveAlphanumericSender(); } }