mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 16:54:05 +00:00
Improve writing
This commit is contained in:
parent
371b3836b6
commit
677fdb23b9
3 changed files with 7 additions and 7 deletions
|
|
@ -37,7 +37,7 @@ return [
|
|||
|
||||
|
||||
/**
|
||||
* Pending tenancy config.
|
||||
* Pending tenants config.
|
||||
* This is useful if you're looking for a way to always have a tenant ready to be used.
|
||||
*/
|
||||
'pending' => [
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class ClearPendingTenants extends Command
|
|||
// We compare the original expiration date to the new one to check if the new one is different later
|
||||
$originalExpirationDate = $expirationDate->copy()->toImmutable();
|
||||
|
||||
// If the 'all' option is given, skip the expiry date configuration
|
||||
// Skip the time constraints if the 'all' option is given
|
||||
if (! $this->option('all')) {
|
||||
if ($olderThanDays = $this->option('older-days') ?? config('tenancy.pending.older_than_days')) {
|
||||
$expirationDate->subDays($olderThanDays);
|
||||
|
|
@ -48,7 +48,7 @@ class ClearPendingTenants extends Command
|
|||
}
|
||||
}
|
||||
|
||||
$deletedPendingCount = tenancy()
|
||||
$deletedTenantCount = tenancy()
|
||||
->query()
|
||||
->onlyPending()
|
||||
->when($originalExpirationDate->notEqualTo($expirationDate), function (Builder $query) use ($expirationDate) {
|
||||
|
|
@ -59,6 +59,6 @@ class ClearPendingTenants extends Command
|
|||
->delete()
|
||||
->count();
|
||||
|
||||
$this->info($deletedPendingCount . ' pending ' . str('tenant')->plural($deletedPendingCount) . ' deleted.');
|
||||
$this->info($deletedTenantCount . ' pending ' . str('tenant')->plural($deletedTenantCount) . ' deleted.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ class CreatePendingTenants extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'tenants:pending {--count= : The number of tenants to be in a pending state}';
|
||||
protected $signature = 'tenants:pending-create {--count= : The number of pending tenants to be created}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create tenants until the pending count is achieved.';
|
||||
protected $description = 'Create pending tenants.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
|
|
@ -36,7 +36,7 @@ class CreatePendingTenants extends Command
|
|||
while ($pendingTenantCount < $maxPendingTenantCount) {
|
||||
tenancy()->model()::createPending();
|
||||
|
||||
// Fetch the count each time to prevent creating too many tenants
|
||||
// Fetching the pending tenant count in each iteration prevents creating too many tenants
|
||||
// If pending tenants are being created somewhere else while running this command
|
||||
$pendingTenantCount = $this->getPendingTenantCount();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue