改进 通知系统
This commit is contained in:
parent
3a7272834a
commit
504251badc
@ -52,9 +52,9 @@ public function __construct(User|int $user, string $event, array|Model $data)
|
|||||||
if (Auth::guard('module')->check()) {
|
if (Auth::guard('module')->check()) {
|
||||||
$this->module = Auth::guard('module')->user();
|
$this->module = Auth::guard('module')->user();
|
||||||
|
|
||||||
if (isset($this->data['event'])) {
|
// if (isset($this->data['event'])) {
|
||||||
$this->event = $this->module->id . '.' . $this->data['event'];
|
// $this->event = $this->module->id . '.' . $this->data['event'];
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,13 +17,15 @@ class WebNotification extends Notification
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(array|Model $message)
|
public function __construct(array|Model $message, string $event = 'notification')
|
||||||
{
|
{
|
||||||
if ($message instanceof Model) {
|
if ($message instanceof Model) {
|
||||||
$message = $message->toArray();
|
$this->message = $message->toArray();
|
||||||
|
} else {
|
||||||
|
$this->message = $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->message = $message;
|
$this->message['event'] = $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user