在下表中,我把每個學生放在你屬於表的老師之下。現在,我想要分頁顯示在桌下的學生。所以如果第一個選項卡有10個學生,我可以分頁到5.分頁HTML表
目前,我的代碼沒有做我想做的事情。我如何實現這一目標?
PS:我知道語法會怎樣,如果我想分頁老師喜歡teachers->links()
控制器
$teacher = Teacher::where('branch_id', Auth::user()->branch_id);
return view('create',compact('teachers));
HTML
<div class="nav-tabs-custom" id="tabs">
<ul id="myUL" class="nav nav-tabs">
@foreach($teachers as $teacher)
<li ><a href="#tab_{{ $teacher->id }}" data-toggle="tab" >{!!$teacher->name!!}</a></li>
@endforeach
</ul>
<div class="tab-content">
@foreach($teachers as $key => teacher)
<div class="tab-pane" id="tab_{{ $teacher->id }}">
<table class="table" id="tables">
<thead>
<tr>
<th></th>
<th colspan="5"></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($teacher->students as $std)
<tr>
<td></td>
<td>{{$std->name }}</td>
<td></td>
</tr>
@endforeach
</tbody>
</table>
{{$teacher->stduents->links()}}
</div>
@endforeach
</div>
</div>
@DestinatioN,您可以編輯這一點,認爲它可能重複?我看到沒有重複這個問題:) – Switz
Sry誤讀你的問題。也許這應該是有幫助的https://laracasts.com/discuss/channels/eloquent/how-to-paginate-relations-in-laravel – DestinatioN
@DestinatioN,請刪除重複的標籤 – Switz