]> BookStack Code Mirror - bookstack/blob - app/Console/Commands/ClearViewsCommand.php
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / app / Console / Commands / ClearViewsCommand.php
1 <?php
2
3 namespace BookStack\Console\Commands;
4
5 use BookStack\Activity\Models\View;
6 use Illuminate\Console\Command;
7
8 class ClearViewsCommand extends Command
9 {
10     /**
11      * The name and signature of the console command.
12      *
13      * @var string
14      */
15     protected $signature = 'bookstack:clear-views';
16
17     /**
18      * The console command description.
19      *
20      * @var string
21      */
22     protected $description = 'Clear all view-counts for all entities';
23
24     /**
25      * Execute the console command.
26      */
27     public function handle(): int
28     {
29         View::query()->truncate();
30         $this->comment('Views cleared');
31         return 0;
32     }
33 }