改进 通知系统

This commit is contained in:
iVampireSP.com 2023-01-13 22:26:13 +08:00
parent 3a7272834a
commit 504251badc
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 8 additions and 6 deletions

View File

@ -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'];
// }
}

View File

@ -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;
}
/**