public function actionEstimation() { $e = Yii::$app->request->post('estimation'); //if (Yii::$app->user->isGuest || !in_array($e, [-3, -2, -1, 1, 2, 3])) { if (Yii::$app->user->isGuest || !in_array($e, [-1, 1, 2, 3, 4, 5])) { echo json_encode(['status' => 0]); return; } $photoId = Yii::$app->request->post('photoId'); echo json_encode(['status' => Photo::estimation($photoId, $e)]); }