Skip to content

Commit af72df1

Browse files
authored
Merge pull request #160 from gvlasov/route-registrar-from-di
Create RouteRegistrar with DI instead of literal instantiation
2 parents 29b61cf + c880708 commit af72df1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/RouteAttributesServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected function registerRoutes(): void
2929
return;
3030
}
3131

32-
$routeRegistrar = (new RouteRegistrar(app()->router))
32+
$routeRegistrar = $this->app->make(RouteRegistrar::class, [app()->router])
3333
->useMiddleware(config('route-attributes.middleware') ?? []);
3434

3535
collect($this->getRouteDirectories())->each(function (string|array $directory, string|int $namespace) use ($routeRegistrar) {

0 commit comments

Comments
 (0)