Production applications accumulate records over time: expired tokens, old log entries, soft-deleted rows that were never fully removed. Laravel's Prunable and MassPrunable traits let you define exactly which records should be cleaned up and automate that process with a scheduler.
Prunable
Add the Prunable trait to your model and define a prunable() method returning the query that selects records to delete.
app/Models/PasswordResetToken.php:
use Illuminate\Database\Eloquent\Prunable; class PasswordResetToken extends Model{ use Prunable; public function prunable(): Builder { return static::where('created_at', '<', now()->subDays(7)); }}
Running the artisan command will delete all...