NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Messages for Laravel

Artisan commands

messages:prune permanently deletes messages older than a retention window:

php artisan messages:prune --days=30          # defaults to MESSAGES_PRUNE_DAYS
php artisan messages:prune --thread=42        # limit to one thread
  • --days — the cutoff in days; defaults to prune.days (MESSAGES_PRUNE_DAYS, 90).
  • --thread — limit pruning to one thread id.
  • Prunes unsent (soft-deleted) messages too — it is a hard delete.
  • Removes attachment files when media.cleanup_on_force_delete is on.
  • Re-points each affected thread’s latest message, so the inbox never previews a pruned message.

The command reports how many messages it removed. Schedule it like any other Artisan command to enforce retention. From code, Messages::prune(days: 30, thread: $thread) does the same and returns the count.

Configuration overview

php artisan about   # includes a "Messages" section

The Messages section shows models, key type, publicity, roles, system messages, notifications, broadcasting, preview length, retention and attachment settings — the shape of the configuration only, never content.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.