Skip to content

Commit

Permalink
消息通知统计
Browse files Browse the repository at this point in the history
  • Loading branch information
liyu001989 committed Aug 7, 2020
1 parent 321ed6c commit 988118a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/Http/Controllers/Api/NotificationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@ public function index(Request $request)

return NotificationResource::collection($notifications);
}

public function stats(Request $request)
{
return response()->json([
'unread_count' => $request->user()->notification_count,
]);
}
}
3 changes: 3 additions & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@
// 通知列表
Route::get('notifications', 'NotificationsController@index')
->name('notifications.index');
// 通知统计
Route::get('notifications/stats', 'NotificationsController@stats')
->name('notifications.stats');
});
});
});

0 comments on commit 988118a

Please sign in to comment.