Пример #1
0
$app->post($basePath . '/users/ftue/complet', function (Request $request) use($app, $UsersController, $UserModel) {
    $params = $request->query->all();
    $errorMessage = $UserModel->validate($params, 'ftueComplet');
    if ($errorMessage) {
        return Utils::formatErrorMessage(ERROR_BAD_MODEL, $errorMessage);
    } else {
        return $UsersController->ftueComplet($params);
    }
});
$app->post($basePath . '/users/buy', function (Request $request) use($app, $UsersController, $UserModel) {
    $params = $request->query->all();
    $errorMessage = $UserModel->validate($params, 'buy');
    if ($errorMessage) {
        return Utils::formatErrorMessage(ERROR_BAD_MODEL, $errorMessage);
    } else {
        return $UsersController->buy($params);
    }
});
$app->get($basePath . '/users/experience', function (Request $request) use($app, $UsersController, $UserModel) {
    $params = $request->query->all();
    $errorMessage = $UserModel->validate($params, 'experience');
    if ($errorMessage) {
        return Utils::formatErrorMessage(ERROR_BAD_MODEL, $errorMessage);
    } else {
        return $UsersController->experience($params);
    }
});
$app->post($basePath . '/users/destroy', function (Request $request) use($app, $UsersController, $UserModel) {
    $params = $request->query->all();
    $errorMessage = $UserModel->validate($params, 'destroy');
    if ($errorMessage) {