-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow chaining queueable methods onto trait dispatch.
- Loading branch information
1 parent
827d075
commit 9fde549
Showing
2 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace Illuminate\Foundation\Bus; | ||
|
||
class PendingDispatch | ||
{ | ||
/** | ||
* Create a new pending job dispatch. | ||
* | ||
* @param mixed $job | ||
* @return void | ||
*/ | ||
public function __construct($job) | ||
{ | ||
$this->job = $job; | ||
} | ||
|
||
/** | ||
* Set the desired connection for the job. | ||
* | ||
* @param string|null $connection | ||
* @return $this | ||
*/ | ||
public function onConnection($connection) | ||
{ | ||
$this->job->onConnection($connection); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Set the desired queue for the job. | ||
* | ||
* @param string|null $queue | ||
* @return $this | ||
*/ | ||
public function onQueue($queue) | ||
{ | ||
$this->job->onQueue($queue); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Set the desired delay for the job. | ||
* | ||
* @param \DateTime|int|null $delay | ||
* @return $this | ||
*/ | ||
public function delay($delay) | ||
{ | ||
$this->job->delay($delay); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Handle the object's destruction. | ||
* | ||
* @return void | ||
*/ | ||
public function __destruct() | ||
{ | ||
dispatch($this->job); | ||
} | ||
} |