Commit 06a90310 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix: pass data as array not JSON string for JSONB column

The notifications.data column is JSONB. Database::insert() already
json_encodes the full payload, so passing json_encode() double-encodes
it into a string. Mobile app expects a Map, not a string.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 81cdfd87
...@@ -124,7 +124,7 @@ class NotificationsController ...@@ -124,7 +124,7 @@ class NotificationsController
'title_ar' => $titleAr, 'title_ar' => $titleAr,
'body' => $bodyAr, 'body' => $bodyAr,
'body_ar' => $bodyAr, 'body_ar' => $bodyAr,
'data' => json_encode(['campaign_id' => $campaignId]), 'data' => ['campaign_id' => $campaignId],
]; ];
} }
$result = $this->db->insert('notifications', $rows); $result = $this->db->insert('notifications', $rows);
...@@ -237,7 +237,7 @@ class NotificationsController ...@@ -237,7 +237,7 @@ class NotificationsController
'title_ar' => $titleAr, 'title_ar' => $titleAr,
'body' => $bodyAr, 'body' => $bodyAr,
'body_ar' => $bodyAr, 'body_ar' => $bodyAr,
'data' => json_encode(['campaign_id' => $campaignId]), 'data' => ['campaign_id' => $campaignId],
]); ]);
$success = $result && !isset($result['message']); $success = $result && !isset($result['message']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment