I am writing a website using the Laravel 5.1 framework and I am trying to figure out how to use pretty URLs ( pages/2
as opposed to pages?page=2
). I was really surprised that they did not include a feature that makes this easy.
I'm also interested, if only Laravel can't handle this, how to set a limit on the number of links displayed. I just want << 1 2 3 ... 657 658 659 >>
an example.
Currently my code is as follows:
public function index() // I can pass the $page = 1 here (1 being default)
{
$pages = Page::whereNotNull('approved')->orderBy('created_at', 'desc')->paginate(5);
return view('pages.index', ['pages' => $pages]);
}
And, in my opinion, I have {!! $pages->render() !!}
in the end. This works fine in terms of using the GET variable, of course.
I tried to create a custom presenter extending BootstrapThreePresenter
, but I could not figure out how to connect it to make everything work.
, , Laravel 5.1 - , , Laravel 4. *.