Example #1
0
 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Event();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash('success', '事件<' . $model->title . '>添加成功!  ');
         return $this->redirect(['index']);
     } else {
         return $this->renderAjax('create', ['model' => $model->loadDefaultValues()]);
     }
 }