class HandleCors (View source)

Properties

protected Container $container

The container instance.

protected CorsService $cors

The CORS service instance.

static protected $skipCallbacks

All of the registered skip callbacks.

Methods

__construct(Container $container, CorsService $cors)

Create a new middleware instance.

handle(Request $request, Closure $next)

Handle the incoming request.

bool
hasMatchingPath(Request $request)

Get the path from the configuration to determine if the CORS service should run.

array
getPathsByHost(string $host)

Get the CORS paths for the given host.

static void
skipWhen(Closure $callback)

Register a callback that instructs the middleware to be skipped.

static void
flushState()

Flush the middleware's global state.

Details

__construct(Container $container, CorsService $cors)

Create a new middleware instance.

Parameters

Container $container
CorsService $cors

Response handle(Request $request, Closure $next)

Handle the incoming request.

Parameters

Request $request
Closure $next

Return Value

Response

protected bool hasMatchingPath(Request $request)

Get the path from the configuration to determine if the CORS service should run.

Parameters

Request $request

Return Value

bool

protected array getPathsByHost(string $host)

Get the CORS paths for the given host.

Parameters

string $host

Return Value

array

static void skipWhen(Closure $callback)

Register a callback that instructs the middleware to be skipped.

Parameters

Closure $callback

Return Value

void

static void flushState()

Flush the middleware's global state.

Return Value

void