第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

如何 做搜索后的 分頁

老師 搜索 后的 分頁 如何 做

我的 搜索 它能 顯示 我的 搜索后的條數(shù) 但點(diǎn)擊第二頁 時(shí)直接 回到全局的 page?

若 我在 地址欄 加上page=2就可正常 顯示 了?



正在回答

3 回答

模板中分頁的地方加上搜索的參數(shù),使用Request::input()方法即可,注意參數(shù)層級!

{{ $students->appends(Request::input())->render() }

0 回復(fù) 有任何疑惑可以回復(fù)我~

老師 上面 是我問題 的代碼?

0 回復(fù) 有任何疑惑可以回復(fù)我~

在同一頁面 展示


controller?

public function index(Request $request)
{
? ?if (!empty($request['search'])) {
? ? ? ?$goods = Goods::where('tag', 'like', '%' . $request['search'] . '%')->paginate(10);
? ?} else {
? ? ? ?$goods = Goods::paginate(10);
? ?}
? ?$page_title = "商品列表";
? ?$page_level = $this->page_level;
? ?return view('goods.index', compact('goods','page_title', 'page_level'));
}

index.blade.php

http://img1.sycdn.imooc.com//57dca84900011f6c08030595.jpg

<div class="row">
? ?<div class="col-md-6">
? ? ? ?<div class="box box-primary">
? ? ? ? ? ?<form id="tagsearch" class="form-horizontal" action="{{URL::to('goods')}}" method="get" enctype="multipart/form-data">
? ? ? ? ? ? ? ?<div class="box-header with-border">
? ? ? ? ? ? ? ? ? ?<h3 class="box-title">{{$page_title or "Page Title"}}</h3>
? ? ? ? ? ? ? ? ? ?<input type="hidden" name="_token" value="{{csrf_token()}}">
? ? ? ? ? ? ? ?</div>
? ? ? ? ? ? ? ?<div class="box-body">
? ? ? ? ? ? ? ?</div>
? ? ? ? ? ? ? ?<div class="form-group">
? ? ? ? ? ? ? ? ? ?<label for="name" class="col-sm-3 control-label">標(biāo)簽</label>
? ? ? ? ? ? ? ? ? ?<div class="col-sm-8">
? ? ? ? ? ? ? ? ? ? ? ?<input type="text" class="form-control" id="search" name="search" placeholder="標(biāo)簽" value="">
? ? ? ? ? ? ? ? ? ? ? ?@include('layouts.message.tips',['field'=>'name'])
? ? ? ? ? ? ? ? ? ?</div>
? ? ? ? ? ? ? ?</div>
? ? ? ? ? ? ? ?<div class="box-footer">
? ? ? ? ? ? ? ? ? ?<a class="btn btn-default" href="{{route('goods.index')}}">返回</a>
? ? ? ? ? ? ? ? ? ?<button type="submit" class="btn btn-danger pull-right">搜索</button>
? ? ? ? ? ? ? ?</div>
? ? ? ? ? ?</form>
? ? ? ?</div>
? ?</div>
</div>

<div class="row">
? ?<div class="col-md-12">
? ? ? ?<div class="box">
? ? ? ? ? ?<div class="box-header with-border">
? ? ? ? ? ? ? ?<h3 class="box-title">商品信息列表</h3>
? ? ? ? ? ?</div>
? ? ? ? ? ?<div class="box-body table-responsive no-padding">
? ? ? ? ? ? ? ?<table class="table table-hover">
? ? ? ? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ? ? ? ? ?<th>編號</th>
? ? ? ? ? ? ? ? ? ? ? ?<th>商品名稱</th>
? ? ? ? ? ? ? ? ? ? ? ?<th>標(biāo)簽</th>
? ? ? ? ? ? ? ? ? ? ? ?<th>地址</th>
? ? ? ? ? ? ? ? ? ? ? ?<th>價(jià)格</th>
? ? ? ? ? ? ? ? ? ? ? ?<th>發(fā)布時(shí)間</th>
? ? ? ? ? ? ? ? ? ? ? ?<th>管理操作</th>
? ? ? ? ? ? ? ? ? ?</tr>
? ? ? ? ? ? ? ? ? ?@forelse($goods as $goodinfo)
? ? ? ? ? ? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ?<td>{{ $goodinfo['id'] }}</td>
? ? ? ? ? ? ? ? ? ? ? ? ? ?<td>{{ $goodinfo['name'] ?}}</td>
? ? ? ? ? ? ? ? ? ? ? ? ? ?<td>{{ $goodinfo['tag'] }}</td>
? ? ? ? ? ? ? ? ? ? ? ? ? ?<td>{{ $goodinfo['region'] }}</td>
? ? ? ? ? ? ? ? ? ? ? ? ? ?<td>{{ $goodinfo['price'] }}</td>
? ? ? ? ? ? ? ? ? ? ? ? ? ?<td>{{ $goodinfo['created_at'] }}</td>
? ? ? ? ? ? ? ? ? ? ? ? ? ?<td>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?<button class="btn btn-danger" data-toggle="modal" data-target="#defalutModal" data-url="{{URL::to('goods/'.$goodinfo['id'])}}">
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?@if($goodinfo['status']) 下架 @else 上架 @endif
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?</button>
? ? ? ? ? ? ? ? ? ? ? ? ? ?</td>
? ? ? ? ? ? ? ? ? ? ? ?</tr>
? ? ? ? ? ? ? ? ? ?@empty
? ? ? ? ? ? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ?<td colspan="9" class="text-center">暫無數(shù)據(jù)</td>
? ? ? ? ? ? ? ? ? ? ? ?</tr>
? ? ? ? ? ? ? ? ? ?@endforelse
? ? ? ? ? ? ? ?</table>
? ? ? ? ? ?</div>
? ? ? ? ? ?@if($goods->render() !== "")
? ? ? ? ? ? ? ?<div >
? ? ? ? ? ? ? ? ? ?{!! $goods->render() !!}
? ? ? ? ? ? ? ?</div>
? ? ? ? ? ?@endif
? ? ? ?</div>
? ?</div>
</div>


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

如何 做搜索后的 分頁

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號