Skip to content

Commit 025f63e

Browse files
authoredSep 24, 2024··
fix(laravel): route registration of EntrypointController should be last (#6667)
Fixes #2767
1 parent 0ab3cf4 commit 025f63e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed
 

‎src/Laravel/ApiPlatformProvider.php

+9-8
Original file line numberDiff line numberDiff line change
@@ -1293,14 +1293,6 @@ public function boot(ResourceNameCollectionFactoryInterface $resourceNameCollect
12931293
$route->name('api_doc')->middleware(ApiPlatformMiddleware::class);
12941294
$routeCollection->add($route);
12951295

1296-
$route = new Route(['GET'], $prefix.'/{index?}{_format?}', function (Request $request, Application $app) {
1297-
$entrypointAction = $app->make(EntrypointController::class);
1298-
1299-
return $entrypointAction->__invoke($request);
1300-
});
1301-
$route->where('index', 'index');
1302-
$route->name('api_entrypoint')->middleware(ApiPlatformMiddleware::class);
1303-
$routeCollection->add($route);
13041296
$route = new Route(['GET'], $prefix.'/.well-known/genid/{id}', function (): void {
13051297
throw new NotExposedHttpException('This route is not exposed on purpose. It generates an IRI for a collection resource without identifier nor item operation.');
13061298
});
@@ -1323,6 +1315,15 @@ public function boot(ResourceNameCollectionFactoryInterface $resourceNameCollect
13231315
$routeCollection->add($route);
13241316
}
13251317

1318+
$route = new Route(['GET'], $prefix.'/{index?}{_format?}', function (Request $request, Application $app) {
1319+
$entrypointAction = $app->make(EntrypointController::class);
1320+
1321+
return $entrypointAction->__invoke($request);
1322+
});
1323+
$route->where('index', 'index');
1324+
$route->name('api_entrypoint')->middleware(ApiPlatformMiddleware::class);
1325+
$routeCollection->add($route);
1326+
13261327
$router->setRoutes($routeCollection);
13271328
}
13281329

0 commit comments

Comments
 (0)
Please sign in to comment.