Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Router/AdminRouteGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ private function generateAdminRoutes(): array
];

$adminRoute = new Route($adminRoutePath, defaults: $defaults, methods: $actionRouteConfig['methods']);

if (null !== ($host = $dashboardRouteConfig['routeHost'] ?? null)) {
$adminRoute->setHost($host);
}

$adminRoutes[$adminRouteName] = $adminRoute;
$addedRouteNames[] = $adminRouteName;
}
Expand Down Expand Up @@ -293,6 +298,10 @@ private function generateAdminRoutes(): array

$adminRoute = $this->createRouteForAdminAttribute($currentClassAdminRoute, $adminRoutePath, $dashboardFqcn, $controllerFqcn, '__invoke');

if (null !== ($host = $dashboardRouteConfig['routeHost'] ?? null)) {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check for existant in AdminRoute or override it like here ?

$adminRoute->setHost($host);
}

$adminRoutes[$adminRouteName] = $adminRoute;
$addedRouteNames[] = $adminRouteName;
}
Expand Down Expand Up @@ -518,6 +527,7 @@ private function getDashboardsRouteConfig(): array
$adminDashboardAttribute = $attributes[0]->newInstance();
$routeName = $adminDashboardAttribute->routeName;
$routePath = $adminDashboardAttribute->routePath;
$routeHost = $adminDashboardAttribute->routeOptions['host'] ?? null;
if (null !== $routePath) {
$routePath = rtrim($adminDashboardAttribute->routePath, '/');
}
Expand All @@ -526,6 +536,7 @@ private function getDashboardsRouteConfig(): array
$config[$reflectionClass->getName()] = [
'routeName' => $routeName,
'routePath' => $routePath,
'routeHost' => $routeHost,
];

continue;
Expand Down