From 997b58cda3177bfe7a199963b1eb0985e950b497 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Sun, 11 Dec 2022 19:33:34 +0800 Subject: [PATCH] TODO WeCom As Channel --- app/Events/ServerEvent.php | 2 +- app/Events/UserEvent.php | 4 +- app/Notifications/WeComChannel.php | 61 ++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 app/Notifications/WeComChannel.php diff --git a/app/Events/ServerEvent.php b/app/Events/ServerEvent.php index 8487a20..fd79397 100644 --- a/app/Events/ServerEvent.php +++ b/app/Events/ServerEvent.php @@ -17,7 +17,7 @@ public function __construct($servers) $this->data = $servers; } - public function broadcastOn() + public function broadcastOn(): Channel { return new Channel('servers'); } diff --git a/app/Events/UserEvent.php b/app/Events/UserEvent.php index 55f5656..8883e18 100644 --- a/app/Events/UserEvent.php +++ b/app/Events/UserEvent.php @@ -44,12 +44,12 @@ public function __construct($user_id, $type, $message) } } - public function broadcastOn() + public function broadcastOn(): PrivateChannel { return new PrivateChannel('users.' . $this->user_id); } - public function broadcastAs() + public function broadcastAs(): string { return 'user'; } diff --git a/app/Notifications/WeComChannel.php b/app/Notifications/WeComChannel.php new file mode 100644 index 0000000..df859e5 --- /dev/null +++ b/app/Notifications/WeComChannel.php @@ -0,0 +1,61 @@ +line('The introduction to the notification.') + ->action('Notification Action', url('/')) + ->line('Thank you for using our application!'); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + // + ]; + } +}