-
Notifications
You must be signed in to change notification settings - Fork 579
/
PruneCommand.php
36 lines (31 loc) · 1 KB
/
PruneCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Laravel\Telescope\Console;
use Illuminate\Console\Command;
use Laravel\Telescope\Contracts\PrunableRepository;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'telescope:prune')]
class PruneCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'telescope:prune {--hours=24 : The number of hours to retain Telescope data} {--keep-exceptions : Retain exception data}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Prune stale entries from the Telescope database';
/**
* Execute the console command.
*
* @param \Laravel\Telescope\Contracts\PrunableRepository $repository
* @return void
*/
public function handle(PrunableRepository $repository)
{
$this->info($repository->prune(now()->subHours($this->option('hours')), $this->option('keep-exceptions')).' entries pruned.');
}
}