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

Remove --all option from ClearPendingTenants

This commit is contained in:
lukinovec 2022-11-28 14:41:18 +01:00
parent 73c5655bc8
commit 3a6e673418

View file

@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Builder;
class ClearPendingTenants extends Command class ClearPendingTenants extends Command
{ {
protected $signature = 'tenants:pending-clear protected $signature = 'tenants:pending-clear
{--all : Override the default settings and deletes all pending tenants}
{--older-than-days= : Deletes all pending tenants older than the amount of days} {--older-than-days= : Deletes all pending tenants older than the amount of days}
{--older-than-hours= : Deletes all pending tenants older than the amount of hours}'; {--older-than-hours= : Deletes all pending tenants older than the amount of hours}';
@ -24,12 +23,7 @@ class ClearPendingTenants extends Command
// We compare the original expiration date to the new one 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();
// Skip the time constraints if the 'all' option is given
if (! $this->option('all')) {
/** @var ?int $olderThanDays */
$olderThanDays = $this->option('older-than-days'); $olderThanDays = $this->option('older-than-days');
/** @var ?int $olderThanHours */
$olderThanHours = $this->option('older-than-hours'); $olderThanHours = $this->option('older-than-hours');
if ($olderThanDays && $olderThanHours) { if ($olderThanDays && $olderThanHours) {
@ -46,7 +40,6 @@ class ClearPendingTenants extends Command
if ($olderThanHours) { if ($olderThanHours) {
$expirationDate->subHours($olderThanHours); $expirationDate->subHours($olderThanHours);
} }
}
$deletedTenantCount = tenancy() $deletedTenantCount = tenancy()
->query() ->query()