Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
fix: Fixed find gatherMiddleware not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Mar 16, 2018
1 parent b28ed9a commit cade0f5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Laravel/Middleware/Cors.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ protected function hasShouldRouteGroup($request): bool
$middlewareGroups = collect(Route::getMiddlewareGroups())->filter(function ($group) use ($shouldClsssName, $shouldAlias) {
return in_array($shouldAlias, $group) || in_array($shouldClsssName, $group);
})->keys();
$gatherMiddleware = Route::getRoutes()->match($request)->gatherMiddleware();
$gatherMiddleware = collect(Route::getRoutes()->get())->first(function ($route) use ($request) {
return $route->uri() === $request->path();
})->gatherMiddleware();

if (in_array($shouldClsssName, $gatherMiddleware) || in_array($shouldAlias, $gatherMiddleware)) {
return true;
Expand Down

0 comments on commit cade0f5

Please sign in to comment.