예제 #1
0
 /**
  * Lists all State models.
  * @return mixed
  */
 public function actionIndex()
 {
     $model = new SettingsForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $model->saveSettings();
         Yii::$app->session->setFlash('success', __('Your changes have been saved successfully.'));
         return $this->redirect(['index']);
     } else {
         return $this->render('index', ['model' => $model]);
     }
 }
예제 #2
0
 public function actionIndex()
 {
     $settings = Settings::getAppSettings();
     $model = new SettingsForm();
     $model->loadFromArray(ArrayHelper::map($settings, 'key', 'value'));
     if ($model->load(\Yii::$app->request->post())) {
         $model->app_logo = UploadedFile::getInstance($model, 'app_logo');
         $model->save();
         return $this->refresh();
     }
     return $this->render('index', ['model' => $model]);
 }