insenseanalytics /
laravel-telescope-pruning
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Insense\LaravelTelescopePruning\Commands; |
||
| 4 | |||
| 5 | use Illuminate\Console\Command; |
||
| 6 | use Illuminate\Contracts\Foundation\Application; |
||
| 7 | use Insense\LaravelTelescopePruning\PruneEntries; |
||
| 8 | use Laravel\Telescope\Telescope; |
||
| 9 | |||
| 10 | class TrimCommand extends Command |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The name and signature of the console command. |
||
| 14 | * |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $signature = 'telescope:trim'; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The console command description. |
||
| 21 | * |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | protected $description = 'Trim entries from the Telescope database'; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Execute the console command. |
||
| 28 | * |
||
| 29 | * @param Illuminate\Contracts\Foundation\Application $app |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 30 | * @return void |
||
| 31 | */ |
||
| 32 | public function handle(Application $app) |
||
| 33 | { |
||
| 34 | Telescope::withoutRecording(function () use($app) { |
||
| 35 | $numTrimmed = (new PruneEntries($app))->prune(); |
||
| 36 | |||
| 37 | $this->info($numTrimmed . ' entries trimmed.'); |
||
| 38 | }); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 |