Go to specific page number by controller in Laravel

Okay, here I will show you how to go a specific page number by controller. The default pagination method is like this 👇

public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null);

So, here we pass the page number in the $page variable. Code like this,

$users = User::paginate(5, ['*'], 'page', $pageNumber);

The default convention is


Also if you use $users->links() to generate the navigation button.