Skip to content

Commit

Permalink
fix: route parameters issue about volt and livewire routes
Browse files Browse the repository at this point in the history
  • Loading branch information
izniburak committed Nov 26, 2023
1 parent 0eda2d4 commit 7904f15
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/AutoRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ function () use ($controller, $only, $except, $patterns) {
// Get endpoints and parameter patterns for Route
[$endpoints, $routePatterns] = $this->getRouteValues($method, $patterns);

$endpoints = implode('/', $endpoints);
$endpoint = implode('/', $endpoints);

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

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

Expand All @@ -134,7 +134,7 @@ function () use ($controller, $only, $except, $patterns) {
continue;
}

$handler = $method->invoke(new ($classRef->getName()));
$handler = $method->invoke(new ($classRef->getName()), ...$endpoints);
if (!is_subclass_of($handler, Component::class)) {
continue;
}
Expand Down

0 comments on commit 7904f15

Please sign in to comment.