From c75c76e49a01e80db2ddf344f31cfb0d529dd1b2 Mon Sep 17 00:00:00 2001 From: Jonathan Prass Martins Date: Sat, 25 Feb 2023 11:13:37 -0300 Subject: [PATCH] Add $queue attribute This code enables me to change the queue name that the JobPipeline will be pushed to. Now I can do something like this: ```php JobPipeline::make([ Jobs\CreateDatabase::class, Jobs\MigrateDatabase::class, // Jobs\SeedDatabase::class, // Your own jobs to prepare the tenant. // Provision API keys, create S3 buckets, anything you want! ])->send(function (Events\TenantCreated $event) { return $event->tenant; })->onQueue('another-queue') ->shouldBeQueued() ``` --- src/JobPipeline.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/JobPipeline.php b/src/JobPipeline.php index a3f7bc3..8e69dce 100644 --- a/src/JobPipeline.php +++ b/src/JobPipeline.php @@ -26,6 +26,9 @@ class JobPipeline implements ShouldQueue /** @var bool */ public $shouldBeQueued; + + /** @var string */ + public $queue; public function __construct($jobs, callable $send = null, bool $shouldBeQueued = null) { @@ -56,6 +59,13 @@ class JobPipeline implements ShouldQueue return $this; } + + public function onQueue(string $queue) + { + $this->queue = $queue; + + return $this; + } public function handle(): void {