---
title: "Artisan commands — Messages for Laravel | Roundly"
description: "Prune old messages for retention or privacy with messages:prune, and inspect the configuration with php artisan about."
url: https://roundly-consulting.com/open-source/docs/messages-for-laravel/commands
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Messages for Laravel](https://roundly-consulting.com/open-source/docs/messages-for-laravel.md)

# Artisan commands

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

```bash
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, a whole number of at least 1; defaults to prune.days (MESSAGES\_PRUNE\_DAYS, 90). 0, -1, ten, 1.9 or a blank value exits with an error before anything is deleted.
- \--thread — limit pruning to one thread id. An id that names no thread (soft-deleted ones count) exits with an error rather than pruning every thread.
- 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. It runs through MessagesManager::prune(), so Messages::fake() records a console or scheduled prune too. 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; a window below 1 day throws InvalidArgumentException before anything is deleted.

## Configuration overview

```bash
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](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## 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.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/messages-for-laravel.md)
