Exemplo n.º 1
0
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $pid = $model->parent_id;
     $catid = $model->category_id;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         CacheUtility::createDictCache();
         return $this->redirect(['index', 'pid' => $pid, 'catid' => $catid]);
     } else {
         $locals = [];
         $locals['model'] = $model;
         $locals['parent'] = $this->findModel($pid);
         $locals['parents'] = Dict::getParents($pid);
         $locals['category'] = DictCategory::findOne($catid);
         return $this->render('update', $locals);
     }
 }