Пример #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
 private function initializeItems()
 {
     $this->items = SettingModel::find()->indexBy('key')->all();
 }