Skip to content

Attachment Temp Cleanup (Cron) ​

Command ​

  • php artisan sp-laravel-api:clean-temp-attachments

Cleanup Logic ​

The command targets only temp_private and temp_public:

  1. Expire-first: delete rows where temp_timeout <= now().
  2. Fallback: if temp_timeout is null, delete rows older than created_at + attachments.temp_lifetime.

Suggested Schedule ​

php
protected function schedule(Schedule $schedule)
{
    $schedule->command('sp-laravel-api:clean-temp-attachments')->daily();
}

Safety Options ​

  • --dry-run
  • --force
  • --minutes= override