/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Appoptions::find(); $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, 'ldap_port' => $this->ldap_port, 'smtp_port' => $this->smtp_port]); $query->andFilterWhere(['like', 'server_url', $this->server_url])->andFilterWhere(['like', 'manual_url', $this->manual_url])->andFilterWhere(['like', 'proxy', $this->proxy])->andFilterWhere(['like', 'domain', $this->domain])->andFilterWhere(['like', 'ldap', $this->ldap])->andFilterWhere(['like', 'smtp_host', $this->smtp_host])->andFilterWhere(['like', 'smtp_username', $this->smtp_username])->andFilterWhere(['like', 'smtp_password', $this->smtp_password]); return $dataProvider; }
/** * Finds the Appoptions model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Appoptions the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Appoptions::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }