From 38e609b157a1693c475ec82399357938f1ab7106 Mon Sep 17 00:00:00 2001 From: Kazik Date: Wed, 20 Nov 2024 15:59:39 +0100 Subject: [PATCH] Allow to specify connection in ClearCommand (#1516) --- src/Console/ClearCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Console/ClearCommand.php b/src/Console/ClearCommand.php index a2ebfb10..e3b79c00 100644 --- a/src/Console/ClearCommand.php +++ b/src/Console/ClearCommand.php @@ -21,6 +21,7 @@ class ClearCommand extends Command * @var string */ protected $signature = 'horizon:clear + {connection? : The name of the queue connection} {--queue= : The name of the queue to clear} {--force : Force the operation to run when in production}'; @@ -48,7 +49,8 @@ public function handle(JobRepository $jobRepository, QueueManager $manager) return 1; } - $connection = Arr::first($this->laravel['config']->get('horizon.defaults'))['connection'] ?? 'redis'; + $connection = $this->argument('connection') + ?: Arr::first($this->laravel['config']->get('horizon.defaults'))['connection'] ?? 'redis'; if (method_exists($jobRepository, 'purge')) { $jobRepository->purge($queue = $this->getQueue($connection));