mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 15:54:03 +00:00
Remove --all option from ClearPendingTenants
This commit is contained in:
parent
73c5655bc8
commit
3a6e673418
1 changed files with 12 additions and 19 deletions
|
|
@ -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,28 +23,22 @@ 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
|
$olderThanDays = $this->option('older-than-days');
|
||||||
if (! $this->option('all')) {
|
$olderThanHours = $this->option('older-than-hours');
|
||||||
/** @var ?int $olderThanDays */
|
|
||||||
$olderThanDays = $this->option('older-than-days');
|
|
||||||
|
|
||||||
/** @var ?int $olderThanHours */
|
if ($olderThanDays && $olderThanHours) {
|
||||||
$olderThanHours = $this->option('older-than-hours');
|
$this->line("<options=bold,reverse;fg=red> Cannot use '--older-than-days' and '--older-than-hours' together \n"); // todo@cli refactor all of these styled command outputs to use $this->components
|
||||||
|
$this->line('Please, choose only one of these options.');
|
||||||
|
|
||||||
if ($olderThanDays && $olderThanHours) {
|
return 1; // Exit code for failure
|
||||||
$this->line("<options=bold,reverse;fg=red> Cannot use '--older-than-days' and '--older-than-hours' together \n"); // todo@cli refactor all of these styled command outputs to use $this->components
|
}
|
||||||
$this->line('Please, choose only one of these options.');
|
|
||||||
|
|
||||||
return 1; // Exit code for failure
|
if ($olderThanDays) {
|
||||||
}
|
$expirationDate->subDays($olderThanDays);
|
||||||
|
}
|
||||||
|
|
||||||
if ($olderThanDays) {
|
if ($olderThanHours) {
|
||||||
$expirationDate->subDays($olderThanDays);
|
$expirationDate->subHours($olderThanHours);
|
||||||
}
|
|
||||||
|
|
||||||
if ($olderThanHours) {
|
|
||||||
$expirationDate->subHours($olderThanHours);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$deletedTenantCount = tenancy()
|
$deletedTenantCount = tenancy()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue