I have declared $datas
on the controller.
Controller
class JenisImunisasiController extends Controller
{
public function index()
{
$jenis = JenisImunisasi::get();
return view('admin.jenisimunisasi.index', ['jenis_imunisasis' => $jenis]);
}
}
and the view like this
index.blade.php
@foreach ($datas as $key => $data)
<tr>
<th>{{ $datas->firstItem() + $key}}</th>
<th>{{ $data->nama_imun}}</th>
<th>{{ $data->umur }}</th>
<th>
</th>
</tr>
@endforeach
</tbody>
</table>
</div>
<div>
Showing
{{ $datas->firstItem() }}
to
{{ $datas->lastItem() }}
of
{{ $datas->total() }}
Entries
</div>
<div class="fa-pull-right">
{{ $datas->links() }}
</div>
</div>