1
我目前正在編寫我的laravel項目,我有一個 問題與我的看法有兩個不同的分頁。在第一個分頁中, 當我嘗試點擊(2 - 這是下一頁),第二個分頁會受到影響 即使它在行渲染中有不同的變量。任何人都知道它爲什麼會發生 ?如何在一個視圖中渲染兩個分頁
我控制器
public function viewlist($ship_id){
$members = Member::where('ship_id','=',$ship_id)->paginate(3);
$member = Member::where('ship_id','=',$ship_id)->get();
$member_ids = [];
foreach ($member as $mem) {
array_push($member_ids, $mem->scholar_id);
}
$pendings = AddRequest::where('ship_id','=',$ship_id)->paginate(3);
$pending = AddRequest::where('ship_id','=',$ship_id)->get();
$pending_ids = [];
foreach ($pending as $pend) {
array_push($pending_ids, $pend->scholar_id);
}
$recommends = Recommend::where('ship_id', '=',$ship_id)->get();
return view('pages.Organization.List-Of-Organization-Scholar',compact('ship','schol','pendings','members','count_member','recommends'))
;}
我查看
@foreach($members as $member)
<div class="col-lg-4">
<div class="col-lg-12 well">
<a class="thumbnail" href="#">
<img class="img-responsive" src="../{!! $member->Memscholar->scholar_image !!}" alt="" height="150" width="200">
</a>
</div>
</div>
@endforeach
<div class = "col-md-12">
{!! $members->render() !!}
</div>
@foreach($pendings as $pending)
<div class="col-lg-4">
<div class="col-lg-12 well">
<a class="thumbnail" href="#">
<img class="img-responsive" src="../../{!! $pending->Pendscholar->scholar_image !!}" alt="" height="150" width="200">
</a>
</div>
</div>
@endforeach
<div class = "col-md-12">
{!! $pendings->render() !!}
</div>
ŧ他是我得到「Class」Paginator「找不到」的錯誤。爲什麼要尋找paginator類? – Gatzmar
我想你需要從外部導入它: 使用Illuminate \ Pagination \ Paginator 有關API的更多信息:https://laravel.com/api/5.4/Illuminate/Pagination/Paginator.html –
但是使用laravel 5.0先生不laravel 5.4 – Gatzmar