From d9a818c05af824b6f8535b40e85a2c0a7c71779d Mon Sep 17 00:00:00 2001 From: weiweitoo Date: Wed, 25 Jul 2018 15:02:43 +0800 Subject: [PATCH] Fix notification frontend --- .../Controllers/NotificationController.php | 8 ++- resources/assets/js/components/Navbar.vue | 62 ++++++++++--------- resources/assets/js/pages/home.vue | 3 - routes/api.php | 2 +- 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/app/Http/Controllers/NotificationController.php b/app/Http/Controllers/NotificationController.php index 5769d917..59846fee 100644 --- a/app/Http/Controllers/NotificationController.php +++ b/app/Http/Controllers/NotificationController.php @@ -51,8 +51,10 @@ class NotificationController extends Controller ],200); } - public function readNotification(){ - $affected = DB::table('notifications')->Where('user_id', Auth::user()->id)->update(array('is_read' => 1)); - return response()->json("Read all message", 200); + public function readNotification($notification_id){ + $affected = DB::table('notifications') + ->Where('id', $notification_id) + ->update(array('is_read' => 1)); + return response()->json("Read message", 200); } } \ No newline at end of file diff --git a/resources/assets/js/components/Navbar.vue b/resources/assets/js/components/Navbar.vue index 5bef4d5e..bfe6afe3 100644 --- a/resources/assets/js/components/Navbar.vue +++ b/resources/assets/js/components/Navbar.vue @@ -18,21 +18,22 @@