send notification user method working

This commit is contained in:
isUnknown 2024-10-30 10:56:11 +01:00
parent 14f409abec
commit 9752fffae6
7 changed files with 67 additions and 18 deletions

View file

@ -1,6 +1,6 @@
<?php
return function ($group, $data) {
return function ($group, $item) {
foreach (kirby()->users()->not($this) as $otherUser) {
try {
$notifications = $otherUser->notifications()->isNotEmpty()
@ -10,11 +10,8 @@ return function ($group, $data) {
if (!isset($notifications[$group])) {
$notifications[$group] = [];
}
$data['isRead'] = false;
$notifications[$group][$data['id']] = $data;
$notifications[$group][$item->id()] = $item->toArray();
$otherUser->update([
'notifications' => $notifications