}); $app::Router()->get($app->path('tipoitem_workflow'), function (Request $request, Response $response, $args) { $parse = new RequestParse($request, $args); $estados = EstadoController::getByItemTypeId($parse->get('id')); $workflows = TipoItemController::getWorkflows($parse->get('id')); $resultado = ["estados" => $estados, "workflows" => $workflows]; echo json_encode($resultado); }); $app::Router()->post($app->path('workflow_update'), function (Request $request, Response $response, $args) { $workflows = new Eloquent\Collection(); $body = file_get_contents("php://input"); $body_params = json_decode($body); foreach ($body_params->workflows as $workflow) { $item = new Workflow(); $item->estadoActual()->associate($workflow->idEstadoActual); $item->estadoSiguiente()->associate($workflow->idEstadoSiguiente); $workflows->add($item); } TipoItemController::updateWorkflows($body_params->idItemType, $workflows); json_encode(true); }); $app::Router()->get($app->path('states_tipoitem'), function (Request $request, Response $response, $args) { $parse = new RequestParse($request, $args); $estados = EstadoController::getByItemTypeId($parse->get('id')); $workflows = TipoItemController::getWorkflows($parse->get('id')); $resultado = ["estados" => $estados, "workflows" => $workflows]; echo json_encode($resultado); }); $app::Router()->get($app->path('equipos_atencion'), function (Request $request, Response $response, $args) { $parse = new RequestParse($request, $args); $equiposAtencion = EstadoController::getEquiposDeAtencion($parse->get('id'));