Skip to content

Commit 5629f1a

Browse files
rubengg86Ruben Garciataylorotwell
authored
[11.x] Custom days and hours to passport purge command (#1563)
* Custom days and hours to passport purge command * lint fix * formatting Co-authored-by: Ruben Garcia <[email protected]> Co-authored-by: Taylor Otwell <[email protected]>
1 parent dac2be6 commit 5629f1a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Console/PurgeCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class PurgeCommand extends Command
1515
*/
1616
protected $signature = 'passport:purge
1717
{--revoked : Only purge revoked tokens and authentication codes}
18-
{--expired : Only purge expired tokens and authentication codes}';
18+
{--expired : Only purge expired tokens and authentication codes}
19+
{--hours= : The number of hours to retain expired tokens}';
1920

2021
/**
2122
* The console command description.
@@ -29,7 +30,9 @@ class PurgeCommand extends Command
2930
*/
3031
public function handle()
3132
{
32-
$expired = Carbon::now()->subDays(7);
33+
$expired = $this->option('hours')
34+
? Carbon::now()->subHours($this->option('hours'))
35+
: Carbon::now()->subDays(7);
3336

3437
if (($this->option('revoked') && $this->option('expired')) ||
3538
(! $this->option('revoked') && ! $this->option('expired'))) {

0 commit comments

Comments
 (0)