我想在我的页面上过滤我的用户表。我可以这样做,但仅限于第一页。当我单击第二页时,所有内容都会恢复为默认值,而它应该记住表单输入。这是我的代码:我的 PHP 页面: <h1>users</h1> {{--message voor als een user wordt aangepast. Forget en save zorgen ervoor dat de message niet heel de tijd opnieuw wordt getoond--}} @if(Session::has('flash_message')) <div id="editmessage" class="alert alert-success"> {{ Session::get('flash_message') }} {{ Session::forget('flash_message') }} {{ Session::save() }} </div> @endif <form method="get" action="/admin/users" id="searchForm"> <div class="row"> <div class="col-sm-4 mb-2 lg-4"> <input type="text" class="form-control" name="name" id="name" value="{{ request()->name }}" placeholder="Filter user by name or email"> </div> <div class="col-sm-4 mb-2 lg-4"> <select class="form-control" name="userfilter" id="userfilter"> <option class="genrekeuze" value="id">Sort By ID (default)</option> <option class="genrekeuze" {{ request()->name }} value="name">Name</option> <option class="genrekeuze" {{ request()->email }} value="email">email</option> <option class="genrekeuze" value="active">active</option> <option class="genrekeuze" value="admin">admin</option> </select> </div> <div class="col-sm-4 mb-2 lg-4"> <select class="form-control" name="direction" id="direction"> <option id="richtingboven" class="genrekeuze" value="asc">ascending</option> <option id="richtingonder" class="genrekeuze" value="desc">descending</option> </select> </div> <div class="col-sm-2 mb-2"> <button style="display: inline;" type="submit" class="btn btn-success btn-block">Search</button> </div> </div> </form> <hr>
1 回答
茅侃侃
TA贡献1842条经验 获得超21个赞
您可以将参数附加到$users->links()
因此,您将使用类似{{ $users->appends(request()->except('page'))->links() }}
参考:https ://github.com/laravel/framework/issues/19441
- 1 回答
- 0 关注
- 126 浏览
添加回答
举报
0/150
提交
取消