/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Unitbarang::find()->where('STATUS <> 3'); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['ID' => $this->ID, 'WIGHT' => $this->WIGHT, 'CREATED_AT' => $this->CREATED_AT, 'UPDATED_AT' => $this->UPDATED_AT, 'STATUS' => $this->STATUS]); $query->andFilterWhere(['like', 'KD_UNIT', $this->KD_UNIT])->andFilterWhere(['like', 'NM_UNIT', $this->NM_UNIT])->andFilterWhere(['like', 'SIZE', $this->SIZE])->andFilterWhere(['like', 'COLOR', $this->COLOR])->andFilterWhere(['like', 'NOTE', $this->NOTE])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY]); return $dataProvider; }
public function getUnit() { return $this->hasOne(Unitbarang::className(), ['KD_UNIT' => 'KD_UNIT']); }