コード例 #1
0
ファイル: EventsController.php プロジェクト: MaxFlower/kklk
 /**
  * Creates a new Events model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Events();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #2
0
ファイル: EventsController.php プロジェクト: tqsq2005/Yii2adv
 /**
  * Creates a new Events model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Events();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['index', 'EventsSearch[title]' => $model->title]);
     } else {
         return $this->renderAjax('_form', ['model' => $model]);
     }
 }