/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = LgOngkosKirim::find(); $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(['kode' => $this->kode, 'day' => $this->day, 'harga' => $this->harga]); $query->andFilterWhere(['like', 'tujuan', $this->tujuan])->andFilterWhere(['like', 'harga_perweight', $this->harga_perweight]); return $dataProvider; }
protected function findModelOngkosKirim($id) { if (($model = LgOngkosKirim::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }