Skip to content

Commit 57610f7

Browse files
authored
[11.x] Register console commands, paths and routes after the app is booted (#50716) (#50738)
Co-authored-by: Kacper Pruszynski <[email protected]>
1 parent 598f26b commit 57610f7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Illuminate/Foundation/Configuration/ApplicationBuilder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,11 @@ public function withCommands(array $commands = [])
257257
[$commands, $paths] = collect($commands)->partition(fn ($command) => class_exists($command));
258258
[$routes, $paths] = $paths->partition(fn ($path) => is_file($path));
259259

260-
$kernel->addCommands($commands->all());
261-
$kernel->addCommandPaths($paths->all());
262-
$kernel->addCommandRoutePaths($routes->all());
260+
$this->app->booted(static function () use ($kernel, $commands, $paths, $routes) {
261+
$kernel->addCommands($commands->all());
262+
$kernel->addCommandPaths($paths->all());
263+
$kernel->addCommandRoutePaths($routes->all());
264+
});
263265
});
264266

265267
return $this;

0 commit comments

Comments
 (0)