Skip to content

Commit 7904f15

Browse files
committed
fix: route parameters issue about volt and livewire routes
1 parent 0eda2d4 commit 7904f15

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/AutoRoute.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ function () use ($controller, $only, $except, $patterns) {
113113
// Get endpoints and parameter patterns for Route
114114
[$endpoints, $routePatterns] = $this->getRouteValues($method, $patterns);
115115

116-
$endpoints = implode('/', $endpoints);
116+
$endpoint = implode('/', $endpoints);
117117

118118
$handler = [$classRef->getName(), $method->name];
119-
$routePath = ($path !== $this->mainMethod ? $path : '') . "/{$endpoints}";
119+
$routePath = ($path !== $this->mainMethod ? $path : '') . "/{$endpoint}";
120120

121121
// for volt
122122
if (str_starts_with($method->name, 'volt')) {
123123
if (class_exists(Volt::class) && $method->getReturnType()?->getName() === 'string') {
124-
Volt::route($routePath, $method->invoke(new ($classRef->getName())))
124+
Volt::route($routePath, $method->invoke(new ($classRef->getName()), ...$endpoints))
125125
->where($routePatterns)->name("{$method->name}")->middleware($middleware);
126126
}
127127

@@ -134,7 +134,7 @@ function () use ($controller, $only, $except, $patterns) {
134134
continue;
135135
}
136136

137-
$handler = $method->invoke(new ($classRef->getName()));
137+
$handler = $method->invoke(new ($classRef->getName()), ...$endpoints);
138138
if (!is_subclass_of($handler, Component::class)) {
139139
continue;
140140
}

0 commit comments

Comments
 (0)