You can use the Prunable trait to automatically remove models from your database. You can permanently remove soft deleted models after a few days. class ExampleClass extends Model { use SoftDeletes; use Prunable; public function prunable() { // Files matching this query will be pruned return static::query()->where('deleted_at', ' subDays(14)); } protected function pruning() { // Remove the file from s3 before deleting the model Storage::disk('s3')->delete($this->filename); }} Add PruneCommand to your schedule (app/Console/Kernel.php) $schedule->command(PruneCommand::class)->daily();
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners