Skip to content

Commit 4033c39

Browse files
committed
add Delete Visit Monitoring Records By Specific Days section into README
1 parent 3b1115d commit 4033c39

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,50 @@ If you want to disable monitoring for specific pages you can go to `user-monitor
101101
],
102102
```
103103

104+
### Delete Visit Monitoring Records By Specific Days
105+
106+
You may to delete records by specific days, Laravel-User-Monitoring also support this 🤩.
107+
108+
First, you need go to `user-monitoring` config file and highlighting the days that you want to delete:
109+
110+
```php
111+
'visit_monitoring' => [
112+
...
113+
114+
/*
115+
* If you want to delete visit rows after some days, you can change this like 360,
116+
* but you don't like to delete rows you can change it to 0.
117+
*
118+
* For this feature you need Task-Scheduling => https://laravel.com/docs/10.x/scheduling
119+
*/
120+
'delete_days' => 10,
121+
],
122+
```
123+
124+
After, you need to use [Task Scheduling](https://laravel.com/docs/10.x/scheduling) to fire related command, so go to `app/Console/Kernel.php` and do like this:
125+
126+
```php
127+
<?php
128+
129+
namespace App\Console;
130+
131+
...
132+
use Binafy\LaravelUserMonitoring\Commands\RemoveVisitMonitoringRecordsCommand;
133+
134+
class Kernel extends ConsoleKernel
135+
{
136+
/**
137+
* Define the application's command schedule.
138+
*/
139+
protected function schedule(Schedule $schedule): void
140+
{
141+
$schedule->command(RemoveVisitMonitoringRecordsCommand::class)->hourly();
142+
}
143+
}
144+
```
145+
146+
You can change `hourly` to `minute` or `second`, for more information you can read [Schedule Frequency Options](https://laravel.com/docs/10.x/scheduling#schedule-frequency-options).
147+
104148
<a name="action-monitoring"></a>
105149
## Action Monitoring
106150

0 commit comments

Comments
 (0)