mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 07:54:03 +00:00
Merge branch '2.x' into saas
This commit is contained in:
commit
dfffcebec2
3 changed files with 10 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ return [
|
||||||
'custom_columns' => [
|
'custom_columns' => [
|
||||||
// 'plan',
|
// 'plan',
|
||||||
],
|
],
|
||||||
'connection' => null,
|
'connection' => null, // Your central database connection. Set to null to use the default connection.
|
||||||
'table_names' => [
|
'table_names' => [
|
||||||
'TenantModel' => 'tenants',
|
'TenantModel' => 'tenants',
|
||||||
'DomainModel' => 'domains',
|
'DomainModel' => 'domains',
|
||||||
|
|
@ -27,7 +27,7 @@ return [
|
||||||
// 'localhost',
|
// 'localhost',
|
||||||
],
|
],
|
||||||
'database' => [
|
'database' => [
|
||||||
'based_on' => null, // The connection that will be used as a base for the dynamically created tenant connection.
|
'based_on' => null, // The connection that will be used as a base for the dynamically created tenant connection. Set to null to use the default connection.
|
||||||
'prefix' => 'tenant',
|
'prefix' => 'tenant',
|
||||||
'suffix' => '',
|
'suffix' => '',
|
||||||
],
|
],
|
||||||
|
|
@ -98,4 +98,5 @@ return [
|
||||||
'queue_database_deletion' => false,
|
'queue_database_deletion' => false,
|
||||||
'delete_database_after_tenant_deletion' => false, // delete the tenant's database after deleting the tenant
|
'delete_database_after_tenant_deletion' => false, // delete the tenant's database after deleting the tenant
|
||||||
'unique_id_generator' => Stancl\Tenancy\UniqueIDGenerators\UUIDGenerator::class,
|
'unique_id_generator' => Stancl\Tenancy\UniqueIDGenerators\UUIDGenerator::class,
|
||||||
|
'push_initialization_middleware_to_global_stack' => true,
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,9 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
__DIR__ . '/../assets/migrations/' => database_path('migrations'),
|
__DIR__ . '/../assets/migrations/' => database_path('migrations'),
|
||||||
], 'migrations');
|
], 'migrations');
|
||||||
|
|
||||||
$this->app->make(Kernel::class)->prependMiddleware(Middleware\InitializeTenancy::class);
|
if ($this->app['config']['tenancy.push_initialization_middleware_to_global_stack'] ?? true) {
|
||||||
|
$this->app->make(Kernel::class)->prependMiddleware(Middleware\InitializeTenancy::class);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since tenancy is initialized in the global middleware stack, this
|
* Since tenancy is initialized in the global middleware stack, this
|
||||||
|
|
|
||||||
|
|
@ -301,6 +301,10 @@ class TenantManager
|
||||||
|
|
||||||
public function endTenancy(): self
|
public function endTenancy(): self
|
||||||
{
|
{
|
||||||
|
if (! $this->initialized) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
$prevented = $this->event('ending', $this->getTenant());
|
$prevented = $this->event('ending', $this->getTenant());
|
||||||
|
|
||||||
foreach ($this->tenancyBootstrappers($prevented) as $bootstrapper) {
|
foreach ($this->tenancyBootstrappers($prevented) as $bootstrapper) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue