change notifications structure from object to array
This commit is contained in:
parent
0d25794b87
commit
20824983a6
8 changed files with 64 additions and 50 deletions
|
|
@ -1,17 +1,13 @@
|
|||
<?php
|
||||
|
||||
return function ($group, $item) {
|
||||
return function ($item) {
|
||||
foreach (kirby()->users()->not($this) as $otherUser) {
|
||||
try {
|
||||
$notifications = $otherUser->notifications()->isNotEmpty()
|
||||
? Yaml::decode($otherUser->notifications()->value())
|
||||
: [];
|
||||
|
||||
if (!isset($notifications[$group])) {
|
||||
$notifications[$group] = [];
|
||||
}
|
||||
|
||||
$notifications[$group][$item->id()] = $item->toArray();
|
||||
$notifications[] = $item->toArray();
|
||||
|
||||
$otherUser->update([
|
||||
'notifications' => $notifications
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue