Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/basic-usage/cleaning-up-the-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ protected function schedule(Schedule $schedule)

If you want to automatically cleanup your `production` system you should append the `--force` option as the command will otherwise ask you to confirm the action. This is to prevent accidental data loss.


```php
// routes/console.php (laravel 12)

use Spatie\Activitylog\CleanActivitylogCommand;

Schedule::command(CleanActivitylogCommand::class, ['--force'])->daily();

// app/Console/Kernel.php (for Laravel 12 and below)

use Spatie\Activitylog\CleanActivitylogCommand;

protected function schedule(Schedule $schedule)
{
$schedule->command(CleanActivitylogCommand::class, ['--force'])->daily();
}

```

## Define the log to clean

If you want to clean just one log you can define it as command argument. It will filter the `log_name` attribute of the `Activity` model.
Expand Down