/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Reqvizit::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, 'zip_code' => $this->zip_code]); $query->andFilterWhere(['like', 'company_name', $this->company_name])->andFilterWhere(['like', 'country', $this->country])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'fax', $this->fax])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'schet', $this->schet])->andFilterWhere(['like', 'inn', $this->inn]); return $dataProvider; }
public function actionContact() { $data = $this->getCommonDate(); $iP = Yii::$app->session->id; $quantityInCart = Cart::getQountAllByIp($iP); $modelReqvizit = Reqvizit::findOne(1); return $this->render('contact', ['data' => $data, 'quantityInCart' => $quantityInCart, 'modelReqvizit' => $modelReqvizit]); }
/** * Finds the Reqvizit model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Reqvizit the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Reqvizit::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }