From 504251badce899ebf24a89e14378d515fb1a015e Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Fri, 13 Jan 2023 22:26:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Events/Users.php | 6 +++--- app/Notifications/WebNotification.php | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/Events/Users.php b/app/Events/Users.php index c74471b..82e007f 100644 --- a/app/Events/Users.php +++ b/app/Events/Users.php @@ -52,9 +52,9 @@ public function __construct(User|int $user, string $event, array|Model $data) if (Auth::guard('module')->check()) { $this->module = Auth::guard('module')->user(); - if (isset($this->data['event'])) { - $this->event = $this->module->id . '.' . $this->data['event']; - } + // if (isset($this->data['event'])) { + // $this->event = $this->module->id . '.' . $this->data['event']; + // } } diff --git a/app/Notifications/WebNotification.php b/app/Notifications/WebNotification.php index d84ccae..0073691 100644 --- a/app/Notifications/WebNotification.php +++ b/app/Notifications/WebNotification.php @@ -17,13 +17,15 @@ class WebNotification extends Notification * * @return void */ - public function __construct(array|Model $message) + public function __construct(array|Model $message, string $event = 'notification') { if ($message instanceof Model) { - $message = $message->toArray(); + $this->message = $message->toArray(); + } else { + $this->message = $message; } - $this->message = $message; + $this->message['event'] = $event; } /**