使用内置的laravel分页器获取起始行号
firstItem
方法并使用laravel$loop来获取当前行数。
<tbody>
@foreach ($data as $row)
<tr class="text-center">
<td scope="row">{{ $data->firstItem() + $loop->index }}</td>
<td>
@if ($row->id_suppplier < 10)
{{ $prefix='S-'.date('Ymd', strtotime($row->created_at)).$row->id_supplier}}
@endif
</td>
<td>{{ $row->nm_supplier }}</td>
<td>{{ $row->amt_supplier }}</td>
<td>0{{ $row->telp_supplier }}</td>
<td>
<button type="button" onclick="supplierEdit({{$row->id_supplier}})" data-idsupplier="{{ $row->id_supplier }}" class="btn btn-warning pl-4">Edit Data</button>
<a href="/delete/{{ $row->id_supplier }}" type="button" class="btn btn-danger">Delete</a>
</td>
</tr>
@endforeach
</tbody>
{{ $data->links() }}