Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Roomreg::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(['rid' => $this->rid, 'created_dt' => $this->created_dt]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'company', $this->company])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'capacity', $this->capacity])->andFilterWhere(['like', 'usedate', $this->usedate])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 public function actionRegister()
 {
     $model = new Roomreg();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['success', 'id' => $model->rid]);
     } else {
         return $this->render('register', ['model' => $model]);
     }
 }