Beispiel #1
0
    $updated_plugins = Plugin::updatedRecently(30)->where('active', '=', 1)->get();
    Tool::endWithRSS($updated_plugins, "Updated plugins");
});
/**
 * New plugins
 *  most recently added plugins
 */
$new = Tool::makeEndpoint(function () use($app) {
    OAuthHelper::needsScopes(['plugins']);
    $new_plugins = Plugin::mostFreshlyAddedPlugins(10)->where('active', '=', 1)->get();
    Tool::endWithJson($new_plugins);
});
// rss endpoint
$rss_new = Tool::makeEndpoint(function () use($app) {
    $new_plugins = Plugin::mostFreshlyAddedPlugins(30)->where('active', '=', 1)->get();
    Tool::endWithRSS($new_plugins, "New Plugins");
});
/**
 * Remote procedure to star a plugin
 */
$star = Tool::makeEndpoint(function () use($app) {
    OAuthHelper::needsScopes(['plugin:star']);
    $body = Tool::getBody();
    if (!isset($body->plugin_id) || !isset($body->note) || !is_numeric($body->plugin_id) || !is_numeric($body->note)) {
        Tool::endWithJson(["error" => "plugin_id and note should be provided as integer"], 400);
    }
    $plugin = Plugin::where('active', '=', true)->find($body->plugin_id);
    if ($plugin == NULL) {
        Tool::endWithJson(["error" => "you try to note a plugin that doesn't exists"], 400);
    }
    $plugin_star = new PluginStar();