---
title: "Editing, deleting & restoring — Comments for Laravel | Roundly"
description: "Edit a comment’s body, soft-delete and restore it — edits are re-validated, lock-checked and re-scanned for mentions."
url: https://roundly-consulting.com/open-source/docs/comments-for-laravel/editing-deleting
language: en
---

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

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

# Editing, deleting & restoring

```php
use RoundlyConsulting\Comments\Facades\Comments;

Comments::update($comment, 'Edited body'); // dispatches CommentUpdated
Comments::delete($comment);                // soft delete, dispatches CommentDeleted
Comments::restore($comment);               // restore a soft-deleted comment
```

Comments::update() re-runs the write rules on the new body: it is trimmed and length-checked, blocked by a subject lock or a locked thread (CommentsLockedException), and run through the blocklist exactly like a write — a match is rejected with the reject action, or moves the comment to pending or hidden. Mentions are re-synced after every edit, and CommentUpdated is dispatched.

## Soft deletes

Comments are soft-deleted, so nothing is lost by accident. Comments::delete() dispatches CommentDeleted; Comments::restore() brings the comment back and dispatches no event. Trashed comments stay reachable through Eloquent’s soft-delete scopes:

```php
use RoundlyConsulting\Comments\Models\Comment;

Comment::onlyTrashed()->get();     // soft-deleted comments
Comment::withTrashed()->find($id); // include soft-deleted rows
```

## The action behind update()

Comments::update() runs UpdateCommentAction, which takes an UpdateCommentData DTO — call it directly from a job (see DI and actions):

```php
use RoundlyConsulting\Comments\Actions\UpdateCommentAction;
use RoundlyConsulting\Comments\DataTransferObjects\UpdateCommentData;

app(UpdateCommentAction::class)->execute(new UpdateCommentData(
    comment: $comment,
    body: 'Edited body',
));
```

With authorization enabled, edits check the update ability, deletes the delete ability and restores the restore ability.

## 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/comments-for-laravel.md)
