diff --git a/src/Illuminate/Collections/helpers.php b/src/Illuminate/Collections/helpers.php index 9babf4e0f881..deceaaf07c2e 100644 --- a/src/Illuminate/Collections/helpers.php +++ b/src/Illuminate/Collections/helpers.php @@ -76,7 +76,7 @@ function data_get($target, $key, $default = null) if (Arr::accessible($target) && Arr::exists($target, $segment)) { $target = $target[$segment]; - } elseif (is_object($target) && isset($target->{$segment})) { + } elseif (! $target instanceof Closure && is_object($target) && isset($target->{$segment})) { $target = $target->{$segment}; } else { return value($default); diff --git a/src/Illuminate/Queue/DatabaseQueue.php b/src/Illuminate/Queue/DatabaseQueue.php index bce025c53340..c650f7c480fe 100644 --- a/src/Illuminate/Queue/DatabaseQueue.php +++ b/src/Illuminate/Queue/DatabaseQueue.php @@ -118,7 +118,7 @@ public function pushRaw($payload, $queue = null, array $options = []) * @param string $job * @param mixed $data * @param string|null $queue - * @return void + * @return mixed */ public function later($delay, $job, $data = '', $queue = null) { diff --git a/src/Illuminate/Queue/Queue.php b/src/Illuminate/Queue/Queue.php index 4eb87e2a8e4b..f905281e47aa 100755 --- a/src/Illuminate/Queue/Queue.php +++ b/src/Illuminate/Queue/Queue.php @@ -301,6 +301,8 @@ protected function withCreatePayloadHooks($queue, array $payload) */ protected function enqueueUsing($job, $payload, $queue, $delay, $callback) { + $delay ??= data_get($job, 'delay'); + if ($this->shouldDispatchAfterCommit($job) && $this->container->bound('db.transactions')) { return $this->container->make('db.transactions')->addCallback( @@ -325,8 +327,9 @@ function () use ($payload, $queue, $delay, $callback, $job) { */ protected function shouldDispatchAfterCommit($job) { - if (! $job instanceof Closure && is_object($job) && isset($job->afterCommit)) { - return $job->afterCommit; + $afterCommit = data_get($job, 'afterCommit'); + if (! is_null($afterCommit)) { + return $afterCommit; } if (isset($this->dispatchAfterCommit)) {