3

Next button of paginate Laravel is showing the same values as the previous page.

public function getInboxEmails(Request $request){
    $to_user_id = Auth::user()->id;
    $Inbox = DB::table('inboxes')->where('to_user_id',$to_user_id)->where('deletedTo',0)->paginate(5);
    return view('mail',['Inbox'=>$Inbox]);
}

Also I noticed that next_page_url=null , prev_page_url : null and total=1. AND current_page is not changing at all , always is 1

nesh
  • 71
  • 1
  • 8

1 Answers1

0

These are null because you have only one page in results. If the query will return more than one page, these elements will contain integers instead of null.

Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
  • Any idea how to fix it – nesh Jan 26 '18 at 09:58
  • @nesh the point was it's normal and you shouldn't fix it. But if you want to display these links anyway, you need to [modify pagination view](https://stackoverflow.com/a/48284654/1227923). If you want to get pagination results as JSON, you need to modify JSON manually (if you would use 5.5 you could also use Resource class for that). – Alexey Mezenin Jan 26 '18 at 10:01