<?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)
        ->header("Access-Control-Allow-Origin", "https://poa.zitacuaro.tecnm.mx")
      //Métodos que a los que se da acceso
      ->header("Access-Control-Allow-Methods", "POST, PUT")
      //Headers de la petición
      ->header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, X-Token-Auth, Authorization,X-Auth-Token"); 
        /*->header('Access-Control-Allow-Origin','*')
        //header('Access-Control-Allow-Origin:  http://127.0.0.1:8000/');
        ->header('Access-Control-Allow-Headers','Content-Type, X-Auth-Token, Authorization, Origin')
        ->header('Access-Control-Allow-Methods','POST, PUT');*/
    }
}
