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

Refactor models & config

This commit is contained in:
Samuel Štancl 2020-05-24 20:40:10 +02:00
parent f0ff8248e7
commit 2839f45196
9 changed files with 123 additions and 97 deletions

View file

@ -110,7 +110,7 @@ class TenancyServiceProvider extends ServiceProvider
protected function mapRoutes()
{
if (file_exists(base_path('routes/tenant.php'))) {
Route::namespace($this->app['config']['tenancy.tenant_route_namespace'] ?? 'App\Http\Controllers')
Route::namespace('App\Http\Controllers')
->group(base_path('routes/tenant.php'));
}
}

View file

@ -7,20 +7,20 @@ use Stancl\Tenancy\Database\Models\Tenant;
return [
'tenant_model' => Tenant::class,
'internal_prefix' => 'tenancy_',
'id_generator' => Stancl\Tenancy\UUIDGenerator::class,
'domain_model' => Domain::class,
/**
* The list of domains hosting your central app.
*
* Only relevant if you're using the domain or subdomain identification middleware.
*/
'central_domains' => [
'127.0.0.1',
'localhost',
],
/**
* Controller namespace used by routes in routes/tenant.php.
*/
'tenant_route_namespace' => 'App\Http\Controllers',
/**
* Tenancy bootstrappers are executed when tenancy is initialized.
* Their responsibility is making Laravel features tenant-aware.
@ -75,22 +75,6 @@ return [
],
],
/**
* Redis tenancy config. Used by RedisTenancyBoostrapper.
*
* Note: You need phpredis to use Redis tenancy.
*
* Note: You don't need to use this if you're using Redis only for cache.
* Redis tenancy is only relevant if you're making direct Redis calls,
* either using the Redis facade or by injecting it as a dependency.
*/
'redis' => [
'prefix_base' => 'tenant', // Each key in Redis will be prepended by this prefix_base, followed by the tenant id.
'prefixed_connections' => [ // Redis connections whose keys are prefixed, to separate one tenant's keys from another.
// 'default',
],
],
/**
* Cache tenancy config. Used by CacheTenancyBootstrapper.
*
@ -151,6 +135,22 @@ return [
'asset_helper_tenancy' => true,
],
/**
* Redis tenancy config. Used by RedisTenancyBoostrapper.
*
* Note: You need phpredis to use Redis tenancy.
*
* Note: You don't need to use this if you're using Redis only for cache.
* Redis tenancy is only relevant if you're making direct Redis calls,
* either using the Redis facade or by injecting it as a dependency.
*/
'redis' => [
'prefix_base' => 'tenant', // Each key in Redis will be prepended by this prefix_base, followed by the tenant id.
'prefixed_connections' => [ // Redis connections whose keys are prefixed, to separate one tenant's keys from another.
// 'default',
],
],
/**
* Features are classes that provide additional functionality
* not needed for tenancy to be bootstrapped. They are run