diff --git a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php index 89ec3b9cc50f..21abba66917e 100644 --- a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php +++ b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php @@ -282,7 +282,11 @@ public function withMiddleware(?callable $callback = null) */ public function withCommands(array $commands = []) { - if (empty($commands)) { + if (empty($commands) && is_file($this->app->basePath('routes/console.php'))) { + $commands = [$this->app->basePath('routes/console.php')]; + } + + if (empty($commands) && is_dir($this->app->path('Console/Commands'))) { $commands = [$this->app->path('Console/Commands')]; }