mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 12:34:03 +00:00
Correct comments
This commit is contained in:
parent
a9146ae00d
commit
371b3836b6
3 changed files with 7 additions and 7 deletions
|
|
@ -34,10 +34,10 @@ class ClearPendingTenants extends Command
|
||||||
$this->info('Cleaning pending tenants.');
|
$this->info('Cleaning pending tenants.');
|
||||||
|
|
||||||
$expirationDate = now();
|
$expirationDate = now();
|
||||||
// We compare the original and the new expiration date to check if the new one is different later
|
// We compare the original expiration date to the new one to check if the new one is different later
|
||||||
$originalExpirationDate = $expirationDate->copy()->toImmutable();
|
$originalExpirationDate = $expirationDate->copy()->toImmutable();
|
||||||
|
|
||||||
// If the all option is given, skip the expiry date configuration
|
// If the 'all' option is given, skip the expiry date configuration
|
||||||
if (! $this->option('all')) {
|
if (! $this->option('all')) {
|
||||||
if ($olderThanDays = $this->option('older-days') ?? config('tenancy.pending.older_than_days')) {
|
if ($olderThanDays = $this->option('older-days') ?? config('tenancy.pending.older_than_days')) {
|
||||||
$expirationDate->subDays($olderThanDays);
|
$expirationDate->subDays($olderThanDays);
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ class CreatePendingTenants extends Command
|
||||||
while ($pendingTenantCount < $maxPendingTenantCount) {
|
while ($pendingTenantCount < $maxPendingTenantCount) {
|
||||||
tenancy()->model()::createPending();
|
tenancy()->model()::createPending();
|
||||||
|
|
||||||
// Fetch the count each time to prevent creating too many tenants if pending tenants
|
// Fetch the count each time to prevent creating too many tenants
|
||||||
// Are being created somewhere else while running this command
|
// If pending tenants are being created somewhere else while running this command
|
||||||
$pendingTenantCount = $this->getPendingTenantCount();
|
$pendingTenantCount = $this->getPendingTenantCount();
|
||||||
|
|
||||||
$createdCount++;
|
$createdCount++;
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,8 @@ trait HasPending
|
||||||
|
|
||||||
event(new CreatingPendingTenant($tenant));
|
event(new CreatingPendingTenant($tenant));
|
||||||
|
|
||||||
// Update the pending_since value only after the model is created to ensure that
|
// Update the pending_since value only after the tenant is created so it's
|
||||||
// It's not marked as pending until finishing running the migrations, seeders, etc.
|
// Not marked as pending until finishing running the migrations, seeders, etc.
|
||||||
$tenant->update([
|
$tenant->update([
|
||||||
'pending_since' => now()->timestamp,
|
'pending_since' => now()->timestamp,
|
||||||
]);
|
]);
|
||||||
|
|
@ -73,7 +73,7 @@ trait HasPending
|
||||||
static::createPending();
|
static::createPending();
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point, we can guarantee a pending tenant is available
|
// A pending tenant is surely available at this point
|
||||||
$tenant = static::onlyPending()->first();
|
$tenant = static::onlyPending()->first();
|
||||||
|
|
||||||
event(new PullingPendingTenant($tenant));
|
event(new PullingPendingTenant($tenant));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue