/** * Creates a new Userprofile model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Userprofile(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->ID]); } else { return $this->render('create', ['model' => $model]); } }
public function actionCreateAddProfile() { $model = new Userprofile(); if ($model->load(Yii::$app->request->post())) { $base64File = \yii\web\UploadedFile::getInstance($model, 'image'); $File64 = $this->saveimage(file_get_contents($base64File->tempName)); $model->IMG_BASE64 = $File64; $model->ID = Yii::$app->getUserOptcrm->Profile_user()->id; $model->CREATED_BY = Yii::$app->user->identity->username; $model->UPDATED_TIME = date('Y-m-d h:i:s'); $model->save(); return $this->redirect('index'); } else { return $this->renderAjax('_form_add-profile', ['model' => $model]); } }