laravel分页无法保持价值

时间:2018-08-29 12:57:36

标签: laravel paginate

我正在使用laravel分页纸,但是当我像2,3 ..那样更改页面时,它并没有保留我的研究价值。

刀片

 {{ $items->appends(['list' => $list])->links() }}

控制器

if (!empty($request['search'])){
            $list = '';

            $items = Items::where('name', 'LIKE', '%'.$request['search']. '%')->paginate($this->pagination);

        } 
        elseif(!empty($request['list'])){     

            $list= $request['list'];

            $items = Items::where('list_type', 'LIKE', $request['list']. '%')
                                ->orderBy('name')->paginate($this->pagination);

        }
        else{

            $list= '';

            $items = Client::where('list_type', 'LIKE', $request['list']. '%')
                                ->orderBy('name')->paginate($this->pagination);

1 个答案:

答案 0 :(得分:1)

使用此:

{{ $items->appends(request()->query())->links() }}