public function actionChangeAction() { $result = []; $this->layout = 'json'; $ref = Yii::$app->request->get('ref'); $id = Yii::$app->request->get('id'); $page_index = Yii::$app->request->get('page_index', ''); $action = Yii::$app->request->get('action', ''); if (!empty($id)) { $model = new PhotobookForm(); $user_id = AlphaId::id($ref, true); $pb_id = AlphaId::id($id, true); if ($model->loadById($pb_id)) { $result = $model->changeAction($page_index, $action); } else { $result = ['error' => ['msg' => Yii::t('app', 'Фотокнига не найдена')]]; } } else { $result = ['error' => ['msg' => Yii::t('app', 'Фотокнига не найдена')]]; } return $this->render('json', ['result' => $result]); }