예제 #1
0
 public function actionIndex()
 {
     $settings = Setting::find()->indexBy('key')->all();
     if (Model::loadMultiple($settings, Yii::$app->request->post()) && Model::validateMultiple($settings)) {
         foreach ($settings as $setting) {
             $setting->save(false);
         }
         Yii::$app->session->addFlash('success', 'تنظیمات با موفقیت ذخیره شد.');
         return $this->redirect('index');
     }
     return $this->render('index', ['settings' => $settings]);
 }
예제 #2
0
파일: Settings.php 프로젝트: ahb360/cms
 private function initializeItems()
 {
     $this->items = SettingModel::find()->indexBy('key')->all();
 }