Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = order::find();
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'created_at' => $this->created_at, 'country_id' => $this->country_id, 'city_id' => $this->city_id, 'post_index' => $this->post_index, 'payment_type' => $this->payment_type, 'recall' => $this->recall]);
     $query->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'second_name', $this->second_name])->andFilterWhere(['like', 'ser_name', $this->ser_name])->andFilterWhere(['like', 'telephone', $this->telephone])->andFilterWhere(['like', 'street', $this->street])->andFilterWhere(['like', 'comment', $this->comment])->andFilterWhere(['like', 'login', $this->login])->andFilterWhere(['like', 'password', $this->password]);
     return $dataProvider;
 }
 /**
  * Finds the order model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return order the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = order::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }