---
title: "Replies & quoting — Messages for Laravel | Roundly"
description: "Reply to any message in the same thread; a quote snapshot is stored on the reply so it survives edits and deletes."
url: https://roundly-consulting.com/open-source/docs/messages-for-laravel/replies
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)

# Replies & quoting

Any message can reply to another in the same thread. A lightweight snapshot of the quoted message is stored on the reply, so the quote survives the parent being edited or deleted:

```php
use RoundlyConsulting\Messages\Facades\Messages;

$reply = Messages::to($thread)->from($bob)->replyingTo($original)->send('On it!');

$reply->parent;       // the quoted message (relation)
$original->replies;   // every reply to it
$reply->meta['quote']; // ['id', 'sender_id', 'sender_type', 'excerpt'] snapshot
```

The snapshot’s excerpt is the parent’s preview(), truncated to preview.length characters (120 by default) — so a reply to a system notice quotes it as it reads (“Anna joined the conversation.”), never as its translation key. Replying to a message in a different thread — or to one that does not exist — throws MessageException::replyAcrossThreads(); replying to a message its author already unsent throws MessageException::alreadyDeleted().

## Replying through the action

sendMessageTo() on the trait has no reply parameter; use the builder above or pass parentMessageId to the SendMessage action:

```php
use RoundlyConsulting\Messages\Actions\SendMessage;
use RoundlyConsulting\Messages\DataTransferObjects\SendMessageData;

app(SendMessage::class)->execute(new SendMessageData(
    thread: $thread,
    sender: $bob,
    body: 'On it!',
    parentMessageId: $original->getKey(),
));
```

## Rendering replies

MessageResource exposes a reply\_to object (id, excerpt, sender\_id, sender\_type) built from the snapshot, and the Pest expectation toBeReplyTo() asserts the relationship in tests. sender\_type is the quoted sender’s class basename (User), resolved through the morph map — never its class name; the meta.quote snapshot itself keeps the morph type.

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