newbie's avatar

pagination in laravel

how to make a pagination in order to make my data not too long in the page

0 likes
3 replies
newbie's avatar

how will i make conditions for that? in my case i am using a query

public function index() {

     $users = User::withTrashed()->
     paginate(5)->where('account_type','<>','admin')->get();
  
  return view('admin.admin_users', compact('users'));
}
willvincent's avatar

See answer in your other post

..and there really wasn't a need to create a new post. ;)

paginate() should be the last part of the query, no need for get()

public function index() {
  $users = User::withTrashed()->where('account_type', '<>', 'admin')->paginate(5);

  return view('admin.admin_users', compact('users'));
}

Please or to participate in this conversation.