/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Research::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'type_id' => $this->type_id, 'category_id' => $this->category_id, 'fund_id' => $this->fund_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'submit_at' => $this->submit_at, 'reject_at' => $this->reject_at, 'approve_at' => $this->approve_at, 'success_at' => $this->success_at]);
     $query->andFilterWhere(['like', 'kecode', $this->kecode])->andFilterWhere(['like', 'date_receive', $this->date_receive])->andFilterWhere(['like', 'no_receive', $this->no_receive])->andFilterWhere(['like', 'name_th', $this->name_th])->andFilterWhere(['like', 'name_en', $this->name_en])->andFilterWhere(['like', 'fund_description', $this->fund_description])->andFilterWhere(['like', 'detail', $this->detail])->andFilterWhere(['like', 'submission_status', $this->submission_status]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Research::find()->byResearcher();
     $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, 'user_id' => $this->user_id, 'type_id' => $this->type_id, 'category_id' => $this->category_id, 'fund_id' => $this->fund_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'kecode', $this->kecode])->andFilterWhere(['like', 'date_receive', $this->date_receive])->andFilterWhere(['like', 'no_receive', $this->no_receive])->andFilterWhere(['like', 'name_th', $this->name_th])->andFilterWhere(['like', 'name_en', $this->name_en])->andFilterWhere(['like', 'fund_description', $this->fund_description])->andFilterWhere(['like', 'detail', $this->detail]);
     return $dataProvider;
 }
 /**
  * Deletes an existing Research model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     if (($model = Research::find()->byDraft($id)->one()) !== null) {
         $this->addLog($model->id, serialize($model->attributes), 'delete', 'Delete Record');
         $model->delete();
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     return $this->redirect(['index']);
 }