i’ve a problem on my pagination to show data that appearing the empty data which count, this is my controller (actionIndex).
public function actionIndex()
{
$kenaikan2 = KenaikanGolongan::find();
$cloneCount = clone $kenaikan2;
$pagination = new Pagination(['totalCount' => $cloneCount->count(), 'pagesize' => 10]);
// $pagination->route = '//kenaikan-golongan/index';
$articles = $kenaikan2->offset($pagination->offset)->limit($pagination->limit)->all();
$query = KenaikanGolongan::find()->all();
return $this->render('index', [
'articles' => $articles,
'pagination' => $pagination,
]);
}
and this is where i call the pagination.
<?php foreach ($articles as $key) {
$kgbSelanjutnya = strtotime('-4 month', strtotime($key->TGL_KGB_SELANJUTNYA));
$bulanKgbSelanjutnya = date('m', $kgbSelanjutnya);
$kgbSelanjutnya = date('d-m-Y', $kgbSelanjutnya);
$bulan = strtotime($key->TGL_KGB_SELANJUTNYA);
$bulan1 = date('m', $bulan);
$sekarang = date('d-m-Y');
$timeSekarang = strtotime($sekarang);
$yearSekarang = date('Y',$timeSekarang);
$time2 = strtotime($kgbSelanjutnya);
$year2 = date('Y', $time2);
$now = date('m');
<?php if ($now >= $bulanKgbSelanjutnya && $yearSekarang == $year2) {
if ($now <= $bulan1 && $yearSekarang == $year2) {
?>
<tr>
<td><?= $no1++ ?></td>
<td><?= $key->iDPEGAWAI->NAMA_PEGAWAI ?></td>
<td><span class="label label-warning"><?= $key->TGL_PANGKAT_SELANJUTNYA ?></span></td>
<td><span class="label label-success"><?= $key->TGL_KGB_SELANJUTNYA ?></span></td>
</tr>
<?php }
}
} ?>