mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 21:54:02 +00:00
Allow using only one time constraint for clearing the pending tenants
This commit is contained in:
parent
6766237669
commit
2faf9e8683
2 changed files with 20 additions and 3 deletions
|
|
@ -31,7 +31,7 @@ class ClearPendingTenants extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->info('Cleaning pending tenants.');
|
||||
$this->info('Removing pending tenants.');
|
||||
|
||||
$expirationDate = now();
|
||||
// We compare the original expiration date to the new one to check if the new one is different later
|
||||
|
|
@ -39,11 +39,21 @@ class ClearPendingTenants extends Command
|
|||
|
||||
// Skip the time constraints if the 'all' option is given
|
||||
if (! $this->option('all')) {
|
||||
if ($olderThanDays = $this->option('older-than-days')) {
|
||||
$olderThanDays = $this->option('older-than-days');
|
||||
$olderThanHours = $this->option('older-than-hours');
|
||||
|
||||
if ($olderThanDays && $olderThanHours) {
|
||||
$this->line("<options=bold,reverse;fg=red> Cannot use '--older-than-days' and '--older-than-hours' together \n");
|
||||
$this->line('Please, choose only one of these options.');
|
||||
|
||||
return 1; // Exit code for failure
|
||||
}
|
||||
|
||||
if ($olderThanDays) {
|
||||
$expirationDate->subDays($olderThanDays);
|
||||
}
|
||||
|
||||
if ($olderThanHours = $this->option('older-than-hours')) {
|
||||
if ($olderThanHours) {
|
||||
$expirationDate->subHours($olderThanHours);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue