From 3150536dd09c5774d33d7a0b1849933380013173 Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Sun, 11 Oct 2020 10:00:19 +0200 Subject: [PATCH] add delay method to PendingChain --- .../Foundation/Bus/PendingChain.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Illuminate/Foundation/Bus/PendingChain.php b/src/Illuminate/Foundation/Bus/PendingChain.php index 8965e9923fa1..63cd3222e66a 100644 --- a/src/Illuminate/Foundation/Bus/PendingChain.php +++ b/src/Illuminate/Foundation/Bus/PendingChain.php @@ -37,6 +37,13 @@ class PendingChain */ public $queue; + /** + * The number of seconds before the chain should be made available. + * + * @var \DateTimeInterface|\DateInterval|int|null + */ + public $delay; + /** * The callbacks to be executed on failure. * @@ -83,6 +90,19 @@ public function onQueue($queue) return $this; } + /** + * Set the desired delay for the chain. + * + * @param \DateTimeInterface|\DateInterval|int|null $delay + * @return $this + */ + public function delay($delay) + { + $this->delay = $delay; + + return $this; + } + /** * Add a callback to be executed on job failure. * @@ -126,6 +146,7 @@ public function dispatch() $firstJob->allOnConnection($this->connection); $firstJob->allOnQueue($this->queue); $firstJob->chain($this->chain); + $firstJob->delay($this->delay); $firstJob->chainCatchCallbacks = $this->catchCallbacks(); return app(Dispatcher::class)->dispatch($firstJob);