コード例 #1
0
 /**
  * Creates a new Seasons model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Seasons();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         if (!empty($_FILES['UploadForm']['tmp_name']['file'])) {
             $model->removeImages();
             $model->attachImage($_FILES['UploadForm']['tmp_name']['file']);
             if ($model->errors) {
                 var_dump($model->errors);
                 die;
             }
         }
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }