Reputation: 2412
I want to change pagination URL for Laravel 5.0 from:
http://example.com/en/xyz?page=1
to
I have tried MULTIPLE solutions but nothing works for Laravel 5.0 here:
Laravel Pagination with pretty urls than query string
https://github.com/mayoz/pagination
Is there any fix available?
Upvotes: 2
Views: 1334
Reputation: 1468
required page variable on your route definition and set a default value
Route::get('en/xyz/{page?}', function($page=1) {
$limit = 10;
$results = SomeModel::orderBy('someField')
->skip($limit * $page - 1)
->take($limit)
->get();
return $results;
});
Upvotes: 3