diff --git a/backend/app/Http/Middleware/CorsMiddleware.php b/backend/app/Http/Middleware/CorsMiddleware.php new file mode 100644 index 0000000..58a9a99 --- /dev/null +++ b/backend/app/Http/Middleware/CorsMiddleware.php @@ -0,0 +1,31 @@ + '*', + 'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, PATCH, DELETE', + 'Access-Control-Allow-Credentials' => 'true', + 'Access-Control-Max-Age' => '86400', + 'Access-Control-Allow-Headers' => 'Content-Type, Authorization, X-Requested-With' + ]; + + if ($request->isMethod('OPTIONS')) + { + return response()->json([], 200, $headers); + } + + $response = $next($request); + + foreach($headers as $key => $value) + { + $response->header($key, $value); + } + + return $response; + } +} diff --git a/backend/bootstrap/app.php b/backend/bootstrap/app.php index eacf562..891d15e 100644 --- a/backend/bootstrap/app.php +++ b/backend/bootstrap/app.php @@ -79,6 +79,10 @@ $app->routeMiddleware([ 'log_endpoint' => App\Http\Middleware\LogEndpointHitMiddleware::class ]); +$app->middleware([ + App\Http\Middleware\CorsMiddleware::class, +]); + /* |-------------------------------------------------------------------------- | Register Service Providers diff --git a/database/modelo.vpp b/database/modelo.vpp index c7f1752..ddb1d9f 100644 Binary files a/database/modelo.vpp and b/database/modelo.vpp differ diff --git a/database/modifications/01-user-admin-id.sql b/database/modifications/01-user-admin-id.sql new file mode 100644 index 0000000..06c1b4d --- /dev/null +++ b/database/modifications/01-user-admin-id.sql @@ -0,0 +1,3 @@ +update usuarios + set auth0_id = "auth0|606df4dea32e970069755bd8" + where auth0_id = "auth0|6083af726b4de900695cb232";