/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = HakKacamata::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { $query->where('1=0'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'hak_kacamata', $this->hak_kacamata]); return $dataProvider; }
public function getHakKacamataList() { $dropOptions = \backend\models\HakKacamata::find()->asArray()->all(); return ArrayHelper::map($dropOptions, 'id', 'hak_kacamata'); }
/** * @return \yii\db\ActiveQuery */ public function getHakKacamata() { return $this->hasOne(HakKacamata::className(), ['id' => 'hak_kacamata_id']); }
/** * Finds the HakKacamata model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return HakKacamata the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = HakKacamata::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }