diff --git a/src/Channels/WechatTemplateChannel.php b/src/Channels/WechatTemplateChannel.php index 3e01b63..fa8f13a 100644 --- a/src/Channels/WechatTemplateChannel.php +++ b/src/Channels/WechatTemplateChannel.php @@ -23,7 +23,7 @@ public function send($notifiable, Notification $notification) $message = $notification->{'to' . Str::studly($this->channel)}($notifiable); if ($message instanceof WechatTemplateMessage && ! Arr::get($message->getMessage(), 'touser')) { $message->to($notifiable->routeNotificationFor($this->channel, $notification)); - } elseif ($message instanceof WechatWorkMessage && empty($message->to)) { + } elseif ($message instanceof WechatWorkMessage && empty($message->getToUser())) { $message->toUser($notifiable->routeNotificationFor($this->channel, $notification)); } return $message->send(); diff --git a/src/Messages/WechatWorkMessage.php b/src/Messages/WechatWorkMessage.php index faecd8d..06ea354 100644 --- a/src/Messages/WechatWorkMessage.php +++ b/src/Messages/WechatWorkMessage.php @@ -13,5 +13,9 @@ public function __construct($app) parent::__construct($app); } + public function getToUser() + { + return $this->to; + } }