Skip to content

Commit e026fe8

Browse files
committed
Fix class name resolution issue in route macro
1 parent 00e82a6 commit e026fe8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/ServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected function registerRequestMacro(): void
7777
protected function registerRouterMacro(): void
7878
{
7979
Router::macro('inertia', function ($uri, $component, $props = []) {
80-
return $this->match(['GET', 'HEAD'], $uri, Controller::class)
80+
return $this->match(['GET', 'HEAD'], $uri, '\\'.Controller::class)
8181
->defaults('component', $component)
8282
->defaults('props', $props);
8383
});

tests/ServiceProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function test_route_macro_is_registered(): void
3434
$this->assertEquals($route, $routes->getRoutes()[0]);
3535
$this->assertEquals(['GET', 'HEAD'], $route->methods);
3636
$this->assertEquals('/', $route->uri);
37-
$this->assertEquals(['uses' => 'Inertia\Controller@__invoke', 'controller' => Controller::class], $route->action);
37+
$this->assertEquals(['uses' => '\Inertia\Controller@__invoke', 'controller' => '\Inertia\Controller'], $route->action);
3838
$this->assertEquals(['component' => 'User/Edit', 'props' => ['user' => ['name' => 'Jonathan']]], $route->defaults);
3939
}
4040
}

0 commit comments

Comments
 (0)