mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 18:14:04 +00:00
Rename config from include_in_scope to include_in_queries
This commit is contained in:
parent
e11807490e
commit
c8eadeb363
3 changed files with 4 additions and 4 deletions
|
|
@ -46,7 +46,7 @@ return [
|
||||||
* told otherwise with ::withReadied() or ::onlyReadied().
|
* told otherwise with ::withReadied() or ::onlyReadied().
|
||||||
* Note: when disabled, this will also ignore tenants when runnings any tenants commands (migration, seed, etc.)
|
* Note: when disabled, this will also ignore tenants when runnings any tenants commands (migration, seed, etc.)
|
||||||
*/
|
*/
|
||||||
'include_in_scope' => true,
|
'include_in_queries' => true,
|
||||||
/**
|
/**
|
||||||
* Defines how many tenants you want to be in a readied state.
|
* 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
|
* This value should be changed depending on how often a new tenant is created
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class ReadiedScope implements Scope
|
||||||
*/
|
*/
|
||||||
public function apply(Builder $builder, Model $model)
|
public function apply(Builder $builder, Model $model)
|
||||||
{
|
{
|
||||||
$builder->when(!config('tenancy.readied.include_in_scope'), function (Builder $builder){
|
$builder->when(!config('tenancy.readied.include_in_queries'), function (Builder $builder){
|
||||||
$builder->whereNull('data->readied');
|
$builder->whereNull('data->readied');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,11 +139,11 @@ class ReadiedTenantsTest extends TestCase
|
||||||
{
|
{
|
||||||
Tenant::createReadied();
|
Tenant::createReadied();
|
||||||
|
|
||||||
config(['tenancy.readied.include_in_scope' => false]);
|
config(['tenancy.readied.include_in_queries' => false]);
|
||||||
|
|
||||||
$this->assertCount(0, Tenant::all());
|
$this->assertCount(0, Tenant::all());
|
||||||
|
|
||||||
config(['tenancy.readied.include_in_scope' => true]);
|
config(['tenancy.readied.include_in_queries' => true]);
|
||||||
|
|
||||||
$this->assertCount(1, Tenant::all());
|
$this->assertCount(1, Tenant::all());
|
||||||
Tenant::all();
|
Tenant::all();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue