<?php

use \Slim\Http\Request as Request;
use \Slim\Http\Response as Response;
use App\Model\Auditoria;

$app->post('/auditoria', function (Request $request,  Response $response, $args) {
    $atts = json_decode($request->getBody());
    $objects = array();
    foreach($atts as $att){
        $object = new Auditoria();
        $object->cargar($att);
        $object = $object->save();
        $objects[] = $object;
    }
    $response->getBody()->write(Auditoria::toJSON($objects));
    return $response;
});

