/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return BarangDalam the loaded model * @throws CHttpException */ public function loadModel($id) { $model = BarangDalam::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<label>Obat</label> <table class="table table-bordered"> <thead> <th>No.</th> <th>Nama Obat</th> <th>Harga</th> <th>Diskon</th> <th>Jumlah</th> <th></th> </thead> <tbody> <tr ng-repeat="obat in obatCollection"> <td>{{$index+1}}</td> <td width="40%"> <?php $obat = BarangDalam::model()->findAll(); ?> <select ng-change="updateObat($index, obat.id_obat, obat.jumlah)" ng-model="obat.id_obat"> <?php for ($i = 0; $i < count($obat); $i++) { echo '<option value="' . $obat[$i]['id_barang_dalam'] . '">' . $obat[$i]['nama_barang'] . ' - Rp. ' . number_format($obat[$i]['harga_jual'], 2, ',', '.') . '</option>'; } ?> </select> </td> <td> {{obat.harga}} </td> <td> {{obat.diskon}}
public function loadModelBarang($id) { $model = BarangDalam::model()->findByPk($id); return $model; }