Skip to content

Commit

Permalink
add ability to set console commands directory in ApplicationBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
freebuu committed Jun 22, 2024
1 parent 33424be commit 2886db8
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,15 @@ public function withMiddleware(?callable $callback = null)
/**
* Register additional Artisan commands with the application.
*
* @param array $commands
* @param array|string $commands
* @return $this
*/
public function withCommands(array $commands = [])
public function withCommands(array|string $commands = [])
{
if (empty($commands)) {
$commands = [$this->app->path('Console/Commands')];
}elseif (is_string($commands)) {
$commands = [$this->app->path($commands)];
}

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

0 comments on commit 2886db8

Please sign in to comment.