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