/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Reqdevice::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([
     //            '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,
     //        ]);
     $session = new Session();
     $session->open();
     if ($session['groupid'] != 1) {
         $query->orFilterWhere(['like', 'jobtitle', $this->globalSearch])->orFilterWhere(['like', 'comment', $this->globalSearch])->andFilterWhere(['=', 'jobtype', 4])->andFilterWhere(['=', 'requestby', $session['userid']]);
     } else {
         $query->orFilterWhere(['like', 'jobtitle', $this->globalSearch])->orFilterWhere(['like', 'comment', $this->globalSearch])->andFilterWhere(['=', 'jobtype', 4]);
     }
     return $dataProvider;
 }
 protected function findModel($id)
 {
     if (($model = Reqdevice::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }