Пример #1
0
 /**
  * Creates a new EducationLevel model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new SocialMediaPlatform();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->sp_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new SocialmediaPlatform model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new SocialMediaPlatform();
     if ($model->load(Yii::$app->request->post())) {
         /*print_r($model);
           die();*/
         $model->sp_name = $model->sp_name;
         $model->sp_description = $model->sp_description;
         $model->save();
         return $this->redirect(['view', 'id' => $model->sp_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
     /* if ($model->load(Yii::$app->request->post())) {
               $model->imageFile = UploadedFile::getInstance($model, 'imageFile');
               $save_file = '';
     
     
               if($model->imageFile){
                         $imagepath = 'uploads/socialmedia_image/'; // Create folder under web/uploads/logo
                         $model->sp_logo = $imagepath .rand(10,100).'-'.$model->imageFile->name;
                         $save_file = 1;
                      //print_r($model->sp_logo); die();
                     }
     
                     if ($model->save()) {
                         if($save_file){
                             $model->imageFile->saveAs($model->sp_logo);
                         }
                         return $this->redirect(['view', 'id' => $model->sp_id]);
                     } 
     
     
                 } else {
                     return $this->render('create', [
                         'model' => $model,
                         ]);
                 }*/
 }