mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 03:54:02 +00:00
JobPipeline tests
This commit is contained in:
parent
bd9aad229b
commit
7a2e6bb13e
4 changed files with 108 additions and 12 deletions
|
|
@ -29,11 +29,6 @@ class Tenant extends Model
|
|||
|
||||
public $guarded = [];
|
||||
|
||||
public function domains() // todo not required
|
||||
{
|
||||
return $this->hasMany(Domain::class);
|
||||
}
|
||||
|
||||
public static function internalPrefix(): string
|
||||
{
|
||||
return config('tenancy.database_prefix');
|
||||
|
|
@ -71,6 +66,7 @@ class Tenant extends Model
|
|||
|
||||
public function run(callable $callback)
|
||||
{
|
||||
// todo new logic with the manager
|
||||
$originalTenant = $this->manager->getTenant();
|
||||
|
||||
$this->manager->initializeTenancy($this);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Stancl\Tenancy\Events\Listeners;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Pipeline\Pipeline;
|
||||
|
||||
|
|
@ -71,4 +72,20 @@ class JobPipeline implements ShouldQueue
|
|||
->through($this->jobs)
|
||||
->thenReturn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a closure that runs this listener.
|
||||
*
|
||||
* Technically, the string|Closure typehint is not enforced by
|
||||
* Laravel, but for correct typing we wrap this callable in
|
||||
* simple Closures, to match Laravel's docblock typehint.
|
||||
*
|
||||
* @return Closure
|
||||
*/
|
||||
public function toClosure(): Closure
|
||||
{
|
||||
return function (...$args) {
|
||||
$this->handle(...$args);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue