Ejemplo n.º 1
0
 /**
  * Signs user up.
  *
  * @return Book|null the saved model or null if saving fails
  */
 public function AddForm()
 {
     if ($this->validate()) {
         $model = new AddForm();
         $model->bookname = $this->bookname;
         $model->authorname = $this->authorname;
         $model->about = $this->about;
         $model->page = $this->page;
         // $book->generateAuthKey();
         if ($model->save()) {
             return $model;
         }
     }
     return null;
 }
Ejemplo n.º 2
0
 public function actionAdd()
 {
     //  if (!\Yii::$app->user->isGuest) {
     //     return $this->goHome();
     // }validate
     $model = new AddForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         return $this->render('add', ['model' => $model]);
     } else {
         return $this->render('add', ['model' => $model]);
     }
 }