public function actionIndex($id = null, $action = null) { $model = new Slider(); if ($model->load($_POST)) { $sess = array(); $sess['langs'] = $_POST['Slider']['langs']; $sess['cid'] = $_POST['Slider']['cid']; Yii::$app->session->set('sessSlider', $sess); } $sess = Yii::$app->session->get('sessSlider'); $model->langs = $sess['langs']; if (!$model->langs) { $model->langs = 'thai'; } if (!$model->cid) { $model->cid = 1; } else { $model->cid = $sess['cid']; } $type = new \app\models\TblSlidertype(); if ($type->load(Yii::$app->request->post())) { if (!$type->save()) { throw new \ErrorException($model->getErrors()); } } switch ($action) { case 'published': $this->actionPublished($id); break; case 'order': $this->actionOrder($id, $_REQUEST['ordering'], $_REQUEST['direction']); break; case 'typedelete': $this->typedelete($id); break; } return $this->render('index', ['model' => $model, 'type' => $type]); }