add load more pagination of notificaiton

This commit is contained in:
weiweitoo
2018-07-26 22:58:22 +08:00
parent 8d450fb65e
commit 91c37778dc
6 changed files with 79 additions and 36 deletions
@@ -42,15 +42,16 @@ class NotificationController extends Controller
public function getUserMessage()
{
$user_all_notification = Notification::Where("user_id",Auth::user()->id)->orderby('updated_at','desc')->get();
$user_all_notification = Notification::Where("user_id",Auth::user()->id)
->orderby('updated_at','desc')
->paginate(5);
$user_unread_notification = Notification::Where([["user_id",Auth::user()->id],["is_read",0]])
->orderby('updated_at','desc')
->get();
return response()->json([
"message" =>$user_all_notification,
"unread_message" =>Notification::Where([
["user_id",Auth::user()->id],
["is_read",0]
])->orderby('updated_at','desc')->get()
"unread_message" =>$user_unread_notification
],200);
}