Laravel Pagination links not including other GET parameters

前端 未结 12 648
遥遥无期
遥遥无期 2020-12-04 08:35

I am using Eloquent together with Laravel 4\'s Pagination class.

Problem: When there are some GET parameters in the URL, eg: http://site.com/u

12条回答
  •  日久生厌
    2020-12-04 09:03

    Use this construction, to keep all input params but page

    {!! $myItems->appends(Request::capture()->except('page'))->render() !!}
    

    Why?

    1) you strip down everything that added to request like that

      $request->request->add(['variable' => 123]);
    

    2) you don't need $request as input parameter for the function

    3) you are excluding "page"

    PS) and it works for Laravel 5.1

提交回复
热议问题