/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     if (!in_array($params, ['1', '2', '3', '4', '5', '6', '7'])) {
         $query = Adashboard::find()->where(['jobstatus' => 1]);
     } else {
         $query = Adashboard::find()->where(['jobstatus' => 1, 'jobtype' => $params]);
     }
     $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([
     //            'recid' => $this->recid,
     //            'jobtype' => $this->jobtype,
     //            'jobaction' => $this->jobaction,
     //            'jobdate' => $this->jobdate,
     //            'aproveddate' => $this->aproveddate,
     //            'requestby' => $this->requestby,
     //            'approvedby' => $this->approvedby,
     //            'jobstatus' => $this->jobstatus,
     //            'startdate' => $this->startdate,
     //            'enddate' => $this->enddate,
     //            'operateby' => $this->operateby,
     //        ]);
     $query->orFilterWhere(['like', 'jobtitle', $this->globalSearch])->orFilterWhere(['like', 'comment', $this->globalSearch])->orFilterWhere(['like', 'usdef1', $this->usdef1]);
     return $dataProvider;
 }
 protected function findModel($id)
 {
     if (($model = Adashboard::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }