|
|
@@ -14,7 +14,7 @@ readonly class SendNotificationsHook
|
|
|
}
|
|
|
|
|
|
#[Hook('message.send_notifications')]
|
|
|
- public function handle(array $params): void
|
|
|
+ public function sendNotifications(array $params): void
|
|
|
{
|
|
|
$msgList = [];
|
|
|
foreach ($params as $msg) {
|
|
|
@@ -30,4 +30,21 @@ readonly class SendNotificationsHook
|
|
|
}
|
|
|
$msgList && $this->messageNotificationsEntity->insertAll($msgList);
|
|
|
}
|
|
|
+
|
|
|
+ #[Hook('message.send_admin_notifications')]
|
|
|
+ public function sendAdminNotifications(array $params): void
|
|
|
+ {
|
|
|
+ $msgList = [];
|
|
|
+ foreach ($params as $msg) {
|
|
|
+ $msgList[] = [
|
|
|
+ 'admin_id' => $msg['admin_id'],
|
|
|
+ 'title' => $msg['title'],
|
|
|
+ 'content' => $msg['content'],
|
|
|
+ 'type' => NotificationsTypeEnum::from((int)$msg['type']),
|
|
|
+ 'template_code' => $msg['template_code'],
|
|
|
+ 'template_context' => $msg['template_context'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $msgList && $this->messageNotificationsEntity->insertAll($msgList);
|
|
|
+ }
|
|
|
}
|