Example #1
0
 public function actionIndex()
 {
     $model = new Test();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $model->save();
     } else {
         $newmo = Test::find()->all();
     }
     return $this->render('index', ['model' => $model, 'newmo' => $newmo]);
 }
Example #2
0
 public function search($params)
 {
     $query = Test::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $this->addCondition($query, 'w');
     $this->addCondition($query, 'w', true);
     $this->addCondition($query, 'e');
     $this->addCondition($query, 'e', true);
     $this->addCondition($query, 'r');
     $this->addCondition($query, 'r', true);
     return $dataProvider;
 }
Example #3
0
 /**
  * Finds the Test model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Test the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Test::find($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }