Skip to content

Commit

Permalink
Fix for not automatically registering commands in App\Console\Commands (
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelNitsche authored Sep 25, 2024
1 parent 0f1d0dc commit d76b2f1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Illuminate/Foundation/Configuration/ApplicationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,14 @@ public function withMiddleware(?callable $callback = null)
*/
public function withCommands(array $commands = [])
{
if (empty($commands) && is_file($this->app->basePath('routes/console.php'))) {
$commands = [$this->app->basePath('routes/console.php')];
}
if (empty($commands)) {
if (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')];
if (is_dir($this->app->path('Console/Commands'))) {
$commands = [...$commands, $this->app->path('Console/Commands')];
}
}

$this->app->afterResolving(ConsoleKernel::class, function ($kernel) use ($commands) {
Expand Down

0 comments on commit d76b2f1

Please sign in to comment.