Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions src/Providers/RoutingServiceProvider.php

This file was deleted.

16 changes: 16 additions & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace DragonCode\LaravelRouteNames;

use DragonCode\LaravelRouteNames\Routing\Router;
use Illuminate\Routing\Router as BaseRouter;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;

class ServiceProvider extends BaseServiceProvider
Expand All @@ -16,6 +18,7 @@ public function boot(): void
public function register(): void
{
$this->registerConfig();
$this->extendRouter();
}

protected function publishConfig(): void
Expand All @@ -37,4 +40,17 @@ protected function getPath(): string
{
return __DIR__ . '/../config/route.php';
}

protected function extendRouter(): void
{
$this->app->booting(function (): void {
$this->app->extend(
'router',
static fn(
BaseRouter $router,
$app
): Router => !$router instanceof Router ? new Router($app['events'], $app) : $router
);
});
}
}
2 changes: 0 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

namespace Tests;

use DragonCode\LaravelRouteNames\Providers\RoutingServiceProvider;
use DragonCode\LaravelRouteNames\ServiceProvider;
use Illuminate\Events\EventServiceProvider;
use Illuminate\Log\LogServiceProvider;
Expand All @@ -35,7 +34,6 @@ protected function getPackageProviders($app): array
return [
EventServiceProvider::class,
LogServiceProvider::class,
RoutingServiceProvider::class,
ServiceProvider::class,
];
}
Expand Down