@@ -52,8 +52,57 @@ return [
5252 'ignore-paths' => [
5353
5454 ],
55+
56+ 'pruning' => [
57+ 'enabled' => env('REQUEST_ANALYTICS_PRUNING_ENABLED', true),
58+ 'days' => env('REQUEST_ANALYTICS_PRUNING_DAYS', 90),
59+ ],
5560];
5661```
62+ ### Data Purning
63+ You can delete your data from your database automatically.
64+
65+ If you are using Laravel 11+ then you may use ` model:prune ` command.
66+ Add this to your ` routes/console.php `
67+
68+ ``` php
69+ use Illuminate\Support\Facades\Schedule;
70+
71+ Schedule::command('model:prune', [
72+ '--model' => 'MeShaon\RequestAnalytics\Models\RequestAnalytics',
73+ ])->daily();
74+ ```
75+ Or try this ` bootstarp/app.php `
76+ ``` php
77+ use Illuminate\Console\Scheduling\Schedule;
78+ ->withSchedule(function (Schedule $schedule) {
79+ $schedule->command('model:prune', [
80+ '--model' => 'MeShaon\RequestAnalytics\Models\RequestAnalytics',
81+ ])->daily();
82+ })
83+ ```
84+
85+ If you are using Laravel 10 or below then you may use ` model:prune ` command.
86+ You may define all of your scheduled tasks in the schedule method of your application's ` App\Console\Kernel ` class
87+ ``` php
88+ <?php
89+
90+ namespace App\Console;
91+
92+ use Illuminate\Console\Scheduling\Schedule;
93+ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
94+
95+ class Kernel extends ConsoleKernel
96+ {
97+ protected function schedule(Schedule $schedule): void
98+ {
99+ $schedule->command('model:prune', [
100+ '--model' => 'MeShaon\RequestAnalytics\Models\RequestAnalytics',
101+ ])->daily();
102+ }
103+ }
104+ ```
105+
57106You can publish the assets with this command:
58107``` bash
59108php artisan vendor:publish --tag=" request-analytics-assets"
0 commit comments