Beispiel #1
0
    $tags = Tag::withUsage()->orderBy('plugin_count', 'DESC');
    $tags_lang = clone $tags;
    $tags_lang = $tags_lang->withLang(Tool::getRequestLang());
    if (Tool::preCountQuery($tags_lang) == 0) {
        $tags = $tags->withLang('en');
    } else {
        $tags = $tags->withLang(Tool::getRequestLang());
    }
    Tool::endWithJson(Tool::paginateCollection($tags));
});
$tags_top = Tool::makeEndpoint(function () use($app) {
    OAuthHelper::needsScopes(['tags']);
    $tags = Tag::withUsage()->orderBy('plugin_count', 'DESC')->limit(10);
    $tags_lang = clone $tags;
    $tags_lang = $tags_lang->withLang(Tool::getRequestLang());
    if (Tool::preCountQuery($tags_lang) == 0) {
        $tags = $tags->withLang('en');
    } else {
        $tags = $tags->withLang(Tool::getRequestLang());
    }
    Tool::endWithJson($tags->get());
});
$tag_single = Tool::makeEndpoint(function ($key) use($app) {
    OAuthHelper::needsScopes(['tag']);
    $tag = Tag::where('key', '=', $key)->first();
    if ($tag == NULL) {
        throw new \API\Exception\ResourceNotFound('Tag', $key);
    }
    Tool::endWithJson($tag);
});
$tag_plugins = Tool::makeEndpoint(function ($key) use($app) {