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]); }
public function init() { parent::init(); $this->view->params['appSettings'] = Settings::getAppSettings() ? ArrayHelper::map(Settings::getAppSettings(), 'key', 'value') : ['app_name' => 'YiiMine']; }