mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 23:04:03 +00:00
wip
This commit is contained in:
parent
b12b9c3a54
commit
330ea13efd
1 changed files with 14 additions and 0 deletions
|
|
@ -50,6 +50,7 @@ class TenancyServiceProvider extends ServiceProvider
|
|||
$this->app->register(TenantRouteServiceProvider::class);
|
||||
|
||||
$this->registerTenantRedirectMacro();
|
||||
$this->makeQueuesTenantAware();
|
||||
}
|
||||
|
||||
public function registerTenantRedirectMacro()
|
||||
|
|
@ -65,6 +66,19 @@ class TenancyServiceProvider extends ServiceProvider
|
|||
});
|
||||
}
|
||||
|
||||
public function makeQueuesTenantAware()
|
||||
{
|
||||
$this->app['queue']->createPayloadUsing(function () {
|
||||
return tenancy()->initialized ? ['tenant_uuid' => tenant('uuid')] : [];
|
||||
});
|
||||
|
||||
$this->app['events']->listen(\Illuminate\Queue\Events\JobProcessing::class, function ($event) {
|
||||
if (array_key_exists('tenant_uuid', $event->job->payload())) {
|
||||
tenancy()->initById($event->job->payload()['tenant_uuid']);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue