Skip to main content

Menambahkan Nomer Baris Tabel di Laravel 5

Contoh sederhana memasukkan data ke tabel di Laravel 5.

    <table class="table table-bordered">
<thead>
<tr>
<th>Client Code</th>
<th>Client Name</th>
</tr>
</thead>
<tbody>
@foreach ($client as $data)
<tr>
<td>{{ $data->client_code }}</a></td>
<td>{{ $data->client_name }}</td>
</tr>
@endforeach
</tbody>
</table>

table tanpa nomor
ubah menjadi

    <table class="table table-bordered">
<thead>
<tr>
<th>Client Code</th>
<th>Client Name</th>
</tr>
</thead>
<tbody>
<?php $no = 0;?>
@foreach ($client as $data)
<?php $no++ ;?>
<tr>
<td>{{ $no }}</td>
<td>{{ $data->client_code }}</a></td>
<td>{{ $data->client_name }}</td>
</tr>
@endforeach
</tbody>
</table>

tambah no baris

tommy

Adi bekasta encari e, ja pe la lit renggetna.

Leave a Reply

Your email address will not be published. Required fields are marked *