Ohi*_*lam 4 php pagination laravel
有没有办法在laravel 5.1中获得分页漂亮的URL或类似的东西?
我每页有15行.而且我想在分页上增加行数.
<?php $count = 1; ?>
<tr>
<th>No</th>
<th>Year</th>
<th>Action</th>
</tr>
@foreach($years as $year)
<tr>
<td width="20%">{{ $count++ }}</td>
<td width="50%">{{ $year->year }}</td>
<td width="30%">
<a href="{{ route('admin.year.edit', $year->id) }}" class="btn btn-info">Edit</a>
</td>
</tr>
@endforeach
Run Code Online (Sandbox Code Playgroud)
但是当我进入下一页时,$ count var从头开始.如何获得$ count = 16并且它会增加等等?
小智 11
在Laravel 5.3中,您现在可以$loop在视图中使用该变量.所以你可以这样做:
{{ (($results->currentPage() - 1 ) * $results->perPage() ) + $loop->iteration }}
Run Code Online (Sandbox Code Playgroud)
现在在您的刀片模板中.
| 归档时间: |
|
| 查看次数: |
4828 次 |
| 最近记录: |