From dd6dc1d411c3f0105648de21c20be514d4884d7e Mon Sep 17 00:00:00 2001 From: Maksim Date: Sat, 22 Jun 2024 16:36:25 +0200 Subject: [PATCH] add ability to set console commands directory in ApplicationBuilder --- .../Foundation/Configuration/ApplicationBuilder.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php index 218e5210fc47..f322ec929ccc 100644 --- a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php +++ b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php @@ -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) {