fix send notification to users and create custom user method
This commit is contained in:
parent
9dcb054973
commit
f132049948
3 changed files with 133 additions and 12 deletions
|
|
@ -29,18 +29,7 @@ return [
|
|||
'comments' => $comments
|
||||
]);
|
||||
|
||||
foreach (kirby()->users()->without($user) as $otherUser) {
|
||||
try {
|
||||
$notifications = $otherUser->notifications()->isNotEmpty() ? $otherUser->notifications()->toArray() : ["comments" => []];
|
||||
$notifications['comments'][$data->id] = $newComment;
|
||||
$otherUser->update([
|
||||
"notifications" => $notifications
|
||||
]);
|
||||
} catch (\Throwable $th) {
|
||||
throw new Exception($th->getMessage(), 1);
|
||||
|
||||
}
|
||||
}
|
||||
$user->sendNotification('comments', $newComment);
|
||||
|
||||
return getFileData($newFile);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue