Exemple #1
0
 /**
  * @param mixed $configuration
  * @return IMigrator
  */
 public static function factory($configuration = null)
 {
     if (is_null($configuration)) {
         $configuration = __DIR__ . '/nucleus.json';
     }
     return Nucleus::serviceFactory($configuration, self::NUCLEUS_SERVICE_NAME);
 }
Exemple #2
0
$app->get('/', function () use($app) {
    echo "API de Empollón";
});
$app->group('/nucleus', function () use($app) {
    $app->get('/', function () use($app) {
        $nuclei = Nucleus::valid()->with(['sets' => function ($q) {
            $q->where('is_valid', '=', '1');
        }])->get();
        $res = $app->response();
        $res['Content-Type'] = 'application/json';
        $res->body($nuclei);
    });
    $app->get('/:id', function ($id) use($app) {
        //      $nucleus = Nucleus::find($id);
        $ids = explode(';', $id);
        $nucleus = Nucleus::whereIn('id', $ids)->with(['sets' => function ($q) {
            $q->where('is_valid', '=', '1');
        }])->get();
        $res = $app->response();
        $res['Content-Type'] = 'application/json';
        $res->body($nucleus);
    });
    $app->get('/:id/sets', function ($id) use($app) {
        $ids = explode(';', $id);
        $sets = Set::whereHas('nucleus', function ($q) use($ids) {
            $q->whereIn('id', $ids);
        })->valid()->get();
        $res = $app->response();
        $res['Content-Type'] = 'application/json';
        $res->body($sets);
    });