Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Console/PurgeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class PurgeCommand extends Command
*/
protected $signature = 'passport:purge
{--revoked : Only purge revoked tokens and authentication codes}
{--expired : Only purge expired tokens and authentication codes}';
{--expired : Only purge expired tokens and authentication codes}
{--hours= : The number of hours to retain expired tokens}';

/**
* The console command description.
Expand All @@ -29,7 +30,9 @@ class PurgeCommand extends Command
*/
public function handle()
{
$expired = Carbon::now()->subDays(7);
$expired = $this->option('hours')
? Carbon::now()->subHours($this->option('hours'))
: Carbon::now()->subDays(7);

if (($this->option('revoked') && $this->option('expired')) ||
(! $this->option('revoked') && ! $this->option('expired'))) {
Expand Down