public function actionRecieveLinkForCustomer() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; $ref = Yii::$app->request->get('ref'); $id = Yii::$app->request->get('id'); if (!empty($id)) { $user_id = AlphaId::id($ref, true); $pb_id = AlphaId::id($id, true); if ($user_id != Yii::$app->user->identity->getId()) { return ['error' => ['msg' => Yii::t('app', 'Фотокнига не найдена')]]; } $model = new PhotobookForm(); if ($model->loadById($pb_id)) { return $model->createLinkForCustomer(); } else { return ['error' => ['msg' => Yii::t('app', 'Фотокнига не найдена')]]; } } else { return ['error' => ['msg' => Yii::t('app', 'Фотокнига не найдена')]]; } }