/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = UserEmpZoek::find()->innerJoin('user', 'user_cv.user_id = user.id')->rightJoin('calendar_events', 'user_cv.user_id = calendar_events.user_id')->where('user.role_id=:roleid', [':roleid' => 5]); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } // $query->andFilterWhere([ // 'id' => $this->id, // 'user_id' => $this->user_id, // ]); $query->andFilterWhere(['like', 'zoek', $this->zoek]); return $dataProvider; }
/** * Finds the UserEmpZoek model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return UserEmpZoek the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = UserEmpZoek::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }