Ejemplo n.º 1
0
 public function actionIndex()
 {
     //if(!Yii::$app->user->can('readPost')) throw new HttpException(403, 'No Auth');
     if (Yii::$app->request->isPost) {
         $setting = Yii::$app->request->post('Setting');
         foreach ($setting as $key => $value) {
             Setting::updateAll(['value' => $value], ['code' => $key]);
         }
         Yii::$app->setting->clearCache();
         Yii::$app->getSession()->setFlash('success', 'Save successfully.');
     }
     $settingParent = Setting::find()->where(['parent_id' => 0])->orderBy(['sort_order' => SORT_ASC])->all();
     return $this->render('index', ['settingParent' => $settingParent]);
 }