1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 20:54:04 +00:00

Restructure config

This commit is contained in:
Samuel Štancl 2020-05-21 15:05:05 +02:00
parent 15a7e52208
commit fbe43fbb04
10 changed files with 57 additions and 47 deletions

View file

@ -7,18 +7,10 @@ use Stancl\Tenancy\Database\Models\Tenant;
return [
'tenant_model' => Tenant::class,
'domain_model' => Domain::class,
'internal_prefix' => 'tenancy_',
'central_connection' => 'central',
'template_tenant_connection' => null,
'id_generator' => Stancl\Tenancy\UniqueIDGenerators\UUIDGenerator::class,
'custom_columns' => [
//
],
'domain_model' => Domain::class,
'central_domains' => [
'127.0.0.1',
'localhost',
@ -47,12 +39,40 @@ return [
* Database tenancy config. Used by DatabaseTenancyBootstrapper.
*/
'database' => [
'central_connection' => 'central',
/**
* Connection used as a "template" for the tenant database connection.
*/
'template_tenant_connection' => null,
/**
* Tenant database names are created like this:
* prefix + tenant_id + suffix.
*/
'prefix' => 'tenant',
'suffix' => '',
/**
* TenantDatabaseManagers are classes that handle the creation & deletion of tenant databases.
*/
'managers' => [
'sqlite' => Stancl\Tenancy\TenantDatabaseManagers\SQLiteDatabaseManager::class,
'mysql' => Stancl\Tenancy\TenantDatabaseManagers\MySQLDatabaseManager::class,
'pgsql' => Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLDatabaseManager::class,
/**
* Use this database manager for MySQL to have a DB user created for each tenant database.
* You can customize the grants given to these users by changing the $grants property.
*/
// 'mysql' => Stancl\Tenancy\TenantDatabaseManagers\PermissionControlledMySQLDatabaseManager::class,
/**
* Disable the pgsql manager above, and enable the one below if you
* want to separate tenant DBs by schemas rather than databases.
*/
// 'pgsql' => Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLSchemaManager::class, // Separate by schema instead of database
],
],
/**
@ -131,27 +151,6 @@ return [
'asset_helper_tenancy' => true,
],
/**
* TenantDatabaseManagers are classes that handle the creation & deletion of tenant databases.
*/
'database_managers' => [
'sqlite' => Stancl\Tenancy\TenantDatabaseManagers\SQLiteDatabaseManager::class,
'mysql' => Stancl\Tenancy\TenantDatabaseManagers\MySQLDatabaseManager::class,
'pgsql' => Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLDatabaseManager::class,
/**
* Use this database manager for MySQL to have a DB user created for each tenant database.
* You can customize the grants given to these users by changing the $grants property.
*/
// 'mysql' => Stancl\Tenancy\TenantDatabaseManagers\PermissionControlledMySQLDatabaseManager::class,
/**
* Disable the pgsql manager above, and enable the one below if you
* want to separate tenant DBs by schemas rather than databases.
*/
// 'pgsql' => Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLSchemaManager::class, // Separate by schema instead of database
],
/**
* Features are classes that provide additional functionality
* not needed for tenancy to be bootstrapped. They are run