I am Using Laravel 5.2
Is There a Way To Get a Pagination Pretty URL in Laravel 5.2?
http://localhost:8000/backend/admin_user?page=10&page=1
And What I Would Like To Get,How generate Link Pretty Url:
I am Using Laravel 5.2
Is There a Way To Get a Pagination Pretty URL in Laravel 5.2?
http://localhost:8000/backend/admin_user?page=10&page=1
And What I Would Like To Get,How generate Link Pretty Url:
You can achieve this with three simple steps.
Register the route:
Note the question mark, this makes the
size
andpage
values optional;Implement this function in your controller:
Note the default values,
$size = 10, $page = 1
. This makes sure that you don't get an error if you navigate to the url without the pagination.Use in your view like this:
So you can try something like that:
Route::get('test/{page}', function ($page) { return User::paginate(2, ['*'], 'page', $page); });