Skip to content

Instantly share code, notes, and snippets.

@zofe
zofe / PaginateTrait.php
Last active March 19, 2019 20:30
switch laravel 5 pagination from QueryString To URI, using simple traits on models
<?php
/**
* usage in a controlller:
* public function index($page=1) {
* $users = User::paginateUri(5, $page, $links);
* return view('users', compact('users','links'));
* }
* it also support variable number of parameters,
* routes must be defined using {page} or {page?} placeholders