Skip to content

Commit e216708

Browse files
Auto-Register Commands in routes/console.php (#52867)
1 parent b2a66a8 commit e216708

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Illuminate/Foundation/Configuration/ApplicationBuilder.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,11 @@ public function withMiddleware(?callable $callback = null)
282282
*/
283283
public function withCommands(array $commands = [])
284284
{
285-
if (empty($commands)) {
285+
if (empty($commands) && is_file($this->app->basePath('routes/console.php'))) {
286+
$commands = [$this->app->basePath('routes/console.php')];
287+
}
288+
289+
if (empty($commands) && is_dir($this->app->path('Console/Commands'))) {
286290
$commands = [$this->app->path('Console/Commands')];
287291
}
288292

0 commit comments

Comments
 (0)