/** * Updates an existing ApplicationBaseInfo model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $this->layout = 'index'; $model = $this->findModel($id); $applicationBaseInfo = new ApplicationBaseInfo(); $session = Yii::$app->getSession(); if ($model->load(Yii::$app->request->post())) { $now = time(); $model->update_time = $now; $model->user_id = $session[AdminBaseInfo::SESSION_KEY_ADMIN]['id']; if (!empty($_FILES[ApplicationBaseInfo::APPLICATION_BASE_INFO]['name']['app_logo'])) { $pathName = $applicationBaseInfo->upload('uploads/', $model); if (!$pathName) { return $this->render('update', ['model' => $model]); } } else { unset($model->app_logo); } if ($model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', ['model' => $model]); } } else { return $this->render('update', ['model' => $model]); } }