mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 20:14:03 +00:00
Change default tenant model, write more tests, cleanup
This commit is contained in:
parent
c32f229dd5
commit
de53b81c0e
33 changed files with 210 additions and 90 deletions
|
|
@ -8,7 +8,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
|||
class JobPipeline implements ShouldQueue
|
||||
{
|
||||
/** @var bool */
|
||||
public static $queueByDefault = false;
|
||||
public static $shouldBeQueuedByDefault = false;
|
||||
|
||||
/** @var callable[]|string[] */
|
||||
public $jobs;
|
||||
|
|
@ -22,16 +22,16 @@ class JobPipeline implements ShouldQueue
|
|||
public $passable;
|
||||
|
||||
/** @var bool */
|
||||
public $queue;
|
||||
public $shouldBeQueued;
|
||||
|
||||
public function __construct($jobs, callable $send = null, bool $queue = null)
|
||||
public function __construct($jobs, callable $send = null, bool $shouldBeQueued = null)
|
||||
{
|
||||
$this->jobs = $jobs;
|
||||
$this->send = $send ?? function ($event) {
|
||||
// If no $send callback is set, we'll just pass the event through the jobs.
|
||||
return $event;
|
||||
};
|
||||
$this->queue = $queue ?? static::$queueByDefault;
|
||||
$this->shouldBeQueued = $shouldBeQueued ?? static::$shouldBeQueuedByDefault;
|
||||
}
|
||||
|
||||
/** @param callable[]|string[] $jobs */
|
||||
|
|
@ -47,9 +47,9 @@ class JobPipeline implements ShouldQueue
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function queue(bool $queue)
|
||||
public function shouldBeQueued(bool $shouldBeQueued)
|
||||
{
|
||||
$this->queue = $queue;
|
||||
$this->shouldBeQueued = $shouldBeQueued;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ class JobPipeline implements ShouldQueue
|
|||
return function (...$args) {
|
||||
$executable = $this->executable($args);
|
||||
|
||||
if ($this->queue) {
|
||||
if ($this->shouldBeQueued) {
|
||||
dispatch($executable);
|
||||
} else {
|
||||
dispatch_now($executable);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue