File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,20 +61,42 @@ return [
6161```
6262### Data Purning
6363You can delete your data from your database automatically.
64+
65+ If you are using Laravel 11+ then you may use ` model:prune ` command.
6466Add this to your ` routes/console.php `
6567
6668``` php
6769use Illuminate\Support\Facades\Schedule;
6870
69- Schedule::command('model:prune')->everyMinute ();
70- ```
71- Or If you are using Laravel 11+ then you may use this also into your ` bootstarp/app.php `
71+ Schedule::command('model:prune')->daily ();
72+ ```
73+ Or try this ` bootstarp/app.php `
7274``` php
7375use Illuminate\Console\Scheduling\Schedule;
7476->withSchedule(function (Schedule $schedule) {
75- $schedule->command('model:prune')->everyMinute ();
77+ $schedule->command('model:prune')->daily ();
7678 })
7779```
80+
81+ If you are using Laravel 10 or below then you may use ` model:prune ` command.
82+ You may define all of your scheduled tasks in the schedule method of your application's ` App\Console\Kernel ` class
83+ ``` php
84+ <?php
85+
86+ namespace App\Console;
87+
88+ use Illuminate\Console\Scheduling\Schedule;
89+ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
90+
91+ class Kernel extends ConsoleKernel
92+ {
93+ protected function schedule(Schedule $schedule): void
94+ {
95+ $schedule->command('model:prune')->daily();
96+ }
97+ }
98+ ```
99+
78100You can publish the assets with this command:
79101``` bash
80102php artisan vendor:publish --tag=" request-analytics-assets"
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class RequestAnalytics extends Model
2424 public function prunable (): Builder
2525 {
2626 if (! config ('request-analytics.pruning.enabled ' , false )) {
27- return static :: query ( );
27+ return $ this -> whereRaw ( ' 1 = 0 ' );
2828 }
2929
3030 $ days = config ('request-analytics.pruning.days ' , 90 );
You can’t perform that action at this time.
0 commit comments