<?php

namespace App\Http\Middleware;

use Closure;

class Cors
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        return $next($request)
           //Url a la que se le dará acceso en las peticiones
          ->header("Access-Control-Allow-Origin","https://portal.itzitacuaro.edu.mx")
          //Métodos que a los que se da acceso
          ->header("Access-Control-Allow-Methods", "GET, POST")
          //Headers de la petición
          // ->header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, X-Token-Auth, Authorization, X-Auth-Token, Origin, Accept, Application");
            ->header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, X-Token-Auth, Authorization, X-Auth-Token, Origin, Accept, Application");

    }
}
