From 3c4b4d5ef91799c98cb3d96e7b35952c76b3f767 Mon Sep 17 00:00:00 2001 From: Youssef Mansour Date: Tue, 19 May 2026 01:19:01 +0300 Subject: [PATCH] fix: skip loading route files that don't exist (#2110) --- src/Commands/stubs/route-provider.stub | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Commands/stubs/route-provider.stub b/src/Commands/stubs/route-provider.stub index 937037af7..47f374422 100644 --- a/src/Commands/stubs/route-provider.stub +++ b/src/Commands/stubs/route-provider.stub @@ -35,7 +35,10 @@ class $CLASS$ extends ServiceProvider */ protected function mapWebRoutes(): void { - Route::middleware('web')->group(module_path($this->name, '$WEB_ROUTES_PATH$')); + $path = module_path($this->name, '$WEB_ROUTES_PATH$'); + if (file_exists($path)) { + Route::middleware('web')->group($path); + } } /** @@ -45,6 +48,9 @@ class $CLASS$ extends ServiceProvider */ protected function mapApiRoutes(): void { - Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '$API_ROUTES_PATH$')); + $path = module_path($this->name, '$API_ROUTES_PATH$'); + if (file_exists($path)) { + Route::middleware('api')->prefix('api')->name('api.')->group($path); + } } }