From f9b762de43cfc7d4969283f175601f8949893dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Carodej?= Date: Wed, 4 May 2022 09:20:48 +0200 Subject: [PATCH] notifications api update --- .../FlushUserNotificationsController.php | 15 +++++++++------ .../MarkUserNotificationsAsReadController.php | 19 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/Domain/Notifications/Controllers/FlushUserNotificationsController.php b/src/Domain/Notifications/Controllers/FlushUserNotificationsController.php index b79a53c3..2e993e2c 100644 --- a/src/Domain/Notifications/Controllers/FlushUserNotificationsController.php +++ b/src/Domain/Notifications/Controllers/FlushUserNotificationsController.php @@ -1,22 +1,25 @@ 'success', + 'message' => 'All your notifications was deleted.', + ]; + if (isDemoAccount()) { - return response('Done', 204); + return response()->json($successMessage); } // Delete all notifications auth()->user()->notifications()->delete(); - return response('Done', 204); + return response()->json($successMessage); } } diff --git a/src/Domain/Notifications/Controllers/MarkUserNotificationsAsReadController.php b/src/Domain/Notifications/Controllers/MarkUserNotificationsAsReadController.php index 62491dea..cbab0fc4 100644 --- a/src/Domain/Notifications/Controllers/MarkUserNotificationsAsReadController.php +++ b/src/Domain/Notifications/Controllers/MarkUserNotificationsAsReadController.php @@ -1,22 +1,27 @@ 'success', + 'message' => 'All your notifications was marked as read.', + ]; + if (isDemoAccount()) { - return response('Done', 204); + return response()->json($successMessage); } // Mark all notifications as read - auth()->user()->unreadNotifications()->update(['read_at' => now()]); + auth()->user()->unreadNotifications()->update([ + 'read_at' => now() + ]); - return response('Done', 204); + return response()->json($successMessage); } }