mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 16:24:04 +00:00
Add identification section to config, refactor static properties
This commit is contained in:
parent
e5bc8ddb77
commit
ccaba05272
17 changed files with 153 additions and 97 deletions
|
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
use Stancl\Tenancy\Database\Models\Domain;
|
||||
use Stancl\Tenancy\Database\Models\Tenant;
|
||||
use Stancl\Tenancy\Middleware;
|
||||
use Stancl\Tenancy\Resolvers;
|
||||
|
||||
return [
|
||||
'tenant_model' => Tenant::class,
|
||||
|
|
@ -21,6 +23,56 @@ return [
|
|||
'localhost',
|
||||
],
|
||||
|
||||
'identification' => [
|
||||
/**
|
||||
* The default middleware used for tenant identification.
|
||||
*
|
||||
* If you use multiple forms of identification, you can set this to the "main" approach you use.
|
||||
*/
|
||||
'default_middleware' => Middleware\InitializeTenancyByDomain::class,// todo@identification add this to a 'tenancy' mw group
|
||||
|
||||
/**
|
||||
* All of the identification middleware used by the package.
|
||||
*
|
||||
* If you write your own, make sure to add them to this array.
|
||||
*/
|
||||
'middleware' => [
|
||||
Middleware\InitializeTenancyByDomain::class,
|
||||
Middleware\InitializeTenancyBySubdomain::class,
|
||||
Middleware\InitializeTenancyByDomainOrSubdomain::class,
|
||||
Middleware\InitializeTenancyByPath::class,
|
||||
Middleware\InitializeTenancyByRequestData::class,
|
||||
],
|
||||
|
||||
/**
|
||||
* Tenant resolvers used by the package.
|
||||
*
|
||||
* Resolvers which implement the CachedTenantResolver contract have options for configuring the caching details.
|
||||
* If you add your own resolvers, do not add the 'cache' key unless your resolver is based on CachedTenantResolver.
|
||||
*/
|
||||
'resolvers' => [
|
||||
Resolvers\DomainTenantResolver::class => [
|
||||
'cache' => false,
|
||||
'cache_ttl' => 3600, // seconds
|
||||
'cache_store' => null, // default
|
||||
],
|
||||
Resolvers\PathTenantResolver::class => [
|
||||
'tenant_parameter_name' => 'tenant',
|
||||
|
||||
'cache' => false,
|
||||
'cache_ttl' => 3600, // seconds
|
||||
'cache_store' => null, // default
|
||||
],
|
||||
Resolvers\RequestDataTenantResolver::class => [
|
||||
'cache' => false,
|
||||
'cache_ttl' => 3600, // seconds
|
||||
'cache_store' => null, // default
|
||||
],
|
||||
],
|
||||
|
||||
// todo@docs update integration guides to use Stancl\Tenancy::defaultMiddleware()
|
||||
],
|
||||
|
||||
/**
|
||||
* Tenancy bootstrappers are executed when tenancy is initialized.
|
||||
* Their responsibility is making Laravel features tenant-aware.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue