/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PlafonKacamata::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { $query->where('1=0'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'status_peserta_id' => $this->status_peserta_id, 'hak_kacamata_id' => $this->hak_kacamata_id, 'biaya' => $this->biaya]); $query->andFilterWhere(['like', 'band', $this->band]); return $dataProvider; }
public function actionGetDataPlafon($hak_kacamata_id, $band = null, $status_peserta_id = null) { $dataPlafon = PlafonKacamata::find()->where(['hak_kacamata_id' => $hak_kacamata_id])->andWhere(['band' => $band])->andWhere(['status_peserta_id' => $status_peserta_id])->one(); echo Json::encode($dataPlafon); }