diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 0102686d..3fd91cc8 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -77,7 +77,7 @@ protected function registerRequestMacro(): void protected function registerRouterMacro(): void { Router::macro('inertia', function ($uri, $component, $props = []) { - return $this->match(['GET', 'HEAD'], $uri, Controller::class) + return $this->match(['GET', 'HEAD'], $uri, '\Inertia\Controller') ->defaults('component', $component) ->defaults('props', $props); }); diff --git a/tests/ServiceProviderTest.php b/tests/ServiceProviderTest.php index aa04fa3f..28fe55fe 100644 --- a/tests/ServiceProviderTest.php +++ b/tests/ServiceProviderTest.php @@ -5,7 +5,6 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use Inertia\Controller; class ServiceProviderTest extends TestCase { @@ -34,7 +33,7 @@ public function test_route_macro_is_registered(): void $this->assertEquals($route, $routes->getRoutes()[0]); $this->assertEquals(['GET', 'HEAD'], $route->methods); $this->assertEquals('/', $route->uri); - $this->assertEquals(['uses' => 'Inertia\Controller@__invoke', 'controller' => Controller::class], $route->action); + $this->assertEquals(['uses' => '\Inertia\Controller@__invoke', 'controller' => '\Inertia\Controller'], $route->action); $this->assertEquals(['component' => 'User/Edit', 'props' => ['user' => ['name' => 'Jonathan']]], $route->defaults); } }