/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = MasterBarang::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['ID' => $this->ID, 'HPP' => $this->HPP, 'HARGA' => $this->HARGA, 'STATUS' => $this->STATUS, 'CREATED_AT' => $this->CREATED_AT, 'UPDATED_AT' => $this->UPDATED_AT]); $query->andFilterWhere(['like', 'KD_BARANG', $this->KD_BARANG])->andFilterWhere(['like', 'NM_BARANG', $this->NM_BARANG])->andFilterWhere(['like', 'KD_TYPE', $this->KD_TYPE])->andFilterWhere(['like', 'KD_KATEGORI', $this->KD_KATEGORI])->andFilterWhere(['like', 'KD_UNIT', $this->KD_UNIT])->andFilterWhere(['like', 'KD_SUPPLIER', $this->KD_SUPPLIER])->andFilterWhere(['like', 'KD_DISTRIBUTOR', $this->KD_DISTRIBUTOR])->andFilterWhere(['like', 'PARENT', $this->PARENT])->andFilterWhere(['like', 'BARCODE', $this->BARCODE])->andFilterWhere(['like', 'IMAGE', $this->IMAGE])->andFilterWhere(['like', 'NOTE', $this->NOTE])->andFilterWhere(['like', 'KD_CORP', $this->KD_CORP])->andFilterWhere(['like', 'KD_CAB', $this->KD_CAB])->andFilterWhere(['like', 'KD_DEP', $this->KD_DEP])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY])->andFilterWhere(['like', 'DATA_ALL', $this->DATA_ALL])->andFilterWhere(['like', 'CORP_ID', $this->CORP_ID]); return $dataProvider; }
/** * Finds the MasterBarang model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $ID * @param string $KD_BARANG * @return MasterBarang the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($ID, $KD_BARANG) { if (($model = MasterBarang::findOne(['ID' => $ID, 'KD_BARANG' => $KD_BARANG])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }