public function handle($request, Closure $next)
    {
        $type = 'laravel';
        if ($this->cors->isPreflightRequest($type, $request)) {
            $this->cors->setRequest($type, $request);
            $this->cors->setResponse($type, $response = new Response());
            $this->cors->handle();

            // Set Preflight response status code.
            $response->setStatusCode(204);

            return $response;
        }

        return $next($request);
    }
public function handle($request, Closure $next)
    {
        $type = 'laravel';
        if ($this->cors->isPreflightRequest($type, $request)) {
            $this->cors->setRequest($type, $request);
            $this->cors->setResponse($type, $response = new Response());
            $this->cors->handle();

            // Set Preflight response status code.
            $response->setStatusCode(204);

            return $response;
        }

        return $next($request);
    }
public function handle ( $ request , Closure $ next ) { $ type = 'laravel' ; if ( $ this -> cors -> isPreflightRequest ( $ type , $ request ) ) { $ this -> cors -> setRequest ( $ type , $ request ) ; $ this -> cors -> setResponse ( $ type , $ response = new Response ( ) ) ; $ this -> cors -> handle ( ) ; // Set Preflight response status code. $ response -> setStatusCode ( 204 ) ; return $ response ; } return $ next ( $ request ) ; }
The CORS middleware handle.

@param \Illuminate\Http\Request $request
@param \Closure                 $next

@return mixed

@author Seven Du <shiweidu@outlook.com>
The CORS middleware handle .