/** * Creates a new Customer model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Customer(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Customer model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Customer(); if ($model->load(Yii::$app->request->post())) { $logo = UploadedFile::getInstance($model, 'logo'); $model->logo = $logo->name; $model->url = $this->utf8convert($model->customer_name); $model->save(); $logo->saveAs('images/partners/' . $logo->baseName . '.' . $logo->extension); return $this->redirect('index'); } else { return $this->render('create', ['model' => $model]); } }