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

Join the Conversation

2 Comments

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