コード例 #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]);
     }
 }
コード例 #3
0
 /**
  * Creates a new Retailers model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Retailers();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $event = new Events();
         $event->event = 'Ретейлер добавлен в БД';
         $event->retailer_id = $model->id;
         $event->user_id = Yii::$app->user->id;
         $event->save();
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }