/**
  * 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]);
     }
 }
Beispiel #2
0
 public function actionSubmit()
 {
     $event = new Events();
     $address = new Addresses();
     if ($event->load(yii::$app->request->post()) && $event->save() && $address->load(yii::$app->request->post()) && $address->save()) {
         return $this->render('sucess');
     } else {
         return $this->return('unsucess');
     }
 }
Beispiel #3
0
 /**
  * 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();
     $imagesModel = new Image();
     if ($model->load(Yii::$app->request->post())) {
         $userId = Yii::$app->user->id;
         $model->is_user_organizer = $userId;
         $model->organizer_id = $userId;
         if ($model->save()) {
             $imagesModel->image_file = UploadedFile::getInstance($imagesModel, 'image_file');
             if ($imagesModel->image_file) {
                 $imagesModel->saveEventImage($model->id, 550, 330);
             }
             return $this->redirect(['view', 'id' => $model->id]);
         } else {
             return $this->render('create', ['model' => $model, 'imagesModel' => $imagesModel]);
         }
     } else {
         return $this->render('create', ['model' => $model, 'imagesModel' => $imagesModel]);
     }
 }