コード例 #1
0
 public function actionUpdate($type)
 {
     $settings = SiteService::getAttributeMapBySlugType(Yii::$app->cmgCore->getSiteSlug(), $type);
     $fieldsMap = FormUtil::fillFromModelAttribute("config-{$type}", $settings);
     $model = new GenericForm(['fields' => $fieldsMap]);
     if ($model->load(Yii::$app->request->post(), 'GenericForm') && $model->validate()) {
         $settings = FormUtil::getModelAttributes($model, $settings);
         ModelAttributeService::updateAll($settings);
         return $this->redirect("index?type={$type}");
     }
     return $this->render('update', ['model' => $model, 'type' => $type]);
 }
コード例 #2
0
ファイル: UserService.php プロジェクト: cmsgears/module-core
 public static function updateAttributes($user, $attributes)
 {
     foreach ($attributes as $attribute) {
         ModelAttributeService::update($attribute);
     }
     return true;
 }