1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-06 05:24:04 +00:00

Add readied tenants

Add config for readied tenants
Add `create` and `clear` command
Add Readied scope and static functions
Add tests
This commit is contained in:
j.stein 2022-01-17 09:55:44 +01:00
parent f08e33afd8
commit 065e74c9be
12 changed files with 526 additions and 2 deletions

View file

@ -35,6 +35,37 @@ return [
// Stancl\Tenancy\Bootstrappers\RedisTenancyBootstrapper::class, // Note: phpredis is needed
],
/**
* Readied tenancy config.
* This is useful if you're looking for a way to always have a tenant ready to be used.
*/
'readied' => [
/**
* If disabled, readied tenants will be excluded from all tenant queries. Unless if
* told otherwise with ::withReadied() or ::onlyReadied().
* Note: when disabled, this will also ignore tenants when runnings any tenants commands (migration, seed, etc.)
*/
'include_in_scope' => true,
/**
* Defines how many tenants you want to be in a readied state.
* This value should be changed depending on how often a new tenant is created
* and how often you run the `tenancy:readied` command via the scheduler.
*/
'count' => env('TENANCY_READIED_COUNT', 5),
/**
* If needed, you can define a time limite after when an unused readied tenant
* will automatically be deleted.
* For this to work automatically, make sure to call the `tenancy:readied-clear` command in the scheduler.
*
* If both values are set to null, not time limit will be set and all readied tenants will be deleted.
*/
'older_than_days' => env('TENANCY_READIED_OLDER_THAN_DAYS', null),
'older_than_hours' => env('TENANCY_READIED_OLDER_THAN_HOURS', null),
],
/**
* Database tenancy config. Used by DatabaseTenancyBootstrapper.
*/