-
Notifications
You must be signed in to change notification settings - Fork 121
Pagination
Eric Tucker edited this page Mar 21, 2017
·
1 revision
If you want to paginate your query and keep the url query string without having to use:
{!! $pages->appends(Input::except('page'))->render() !!}
The paginateFilter()
and simplePaginateFilter()
methods accept the same input as Laravel's paginator and returns the respective paginator.
class UserController extends Controller
{
public function index(Request $request)
{
$users = User::filter($request->all())->paginateFilter();
return view('users.index', compact('users'));
}
OR:
public function simpleIndex(Request $request)
{
$users = User::filter($request->all())->simplePaginateFilter();
return view('users.index', compact('users'));
}
}
In your view $users->render()
will return pagination links as it normally would but with the original query string with empty input ignored.