Skip to content

Commit

Permalink
[11.x] Register console commands, paths and routes after the app is b…
Browse files Browse the repository at this point in the history
…ooted (#50716) (#50738)

Co-authored-by: Kacper Pruszynski <[email protected]>
  • Loading branch information
plumthedev and Kacper Pruszynski authored Mar 25, 2024
1 parent 598f26b commit 57610f7
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,11 @@ public function withCommands(array $commands = [])
[$commands, $paths] = collect($commands)->partition(fn ($command) => class_exists($command));
[$routes, $paths] = $paths->partition(fn ($path) => is_file($path));

$kernel->addCommands($commands->all());
$kernel->addCommandPaths($paths->all());
$kernel->addCommandRoutePaths($routes->all());
$this->app->booted(static function () use ($kernel, $commands, $paths, $routes) {
$kernel->addCommands($commands->all());
$kernel->addCommandPaths($paths->all());
$kernel->addCommandRoutePaths($routes->all());
});
});

return $this;
Expand Down

0 comments on commit 57610f7

Please sign in to comment.