Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Fix bug that registered all routes twice
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny Pas committed Oct 14, 2023
1 parent 77cca59 commit cc6151f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ protected function matchMiddleware(string $directory): string|null
*/
protected function routeRegistration(): void
{
// Load all route directories
collect([...File::directories(base_path(self::ROUTE_DIRECTORY)), base_path(self::ROUTE_DIRECTORY)])
->each(function (string $directory): void {
// Load all route files in each directory
$this->registerDirectory($directory);
});
$this->registerDirectory(base_path(self::ROUTE_DIRECTORY));
}

/**
Expand All @@ -69,7 +64,7 @@ protected function routeRegistration(): void
*/
private function registerDirectory(string $directory): void
{
collect(File::allFiles($directory))->each(function (SplFileInfo $fileInfo) use ($directory): void {
collect(File::files($directory))->each(function (SplFileInfo $fileInfo) use ($directory): void {
$this->registerRouteFile($directory, $fileInfo);
});

Expand Down

0 comments on commit cc6151f

Please sign in to comment.