Skip to main content

Readonly Mode

You can make comments readonly by chaining the readonly() method on the action. In readonly mode:

  • Users cannot add new comments
  • Users cannot edit existing comments
  • Users cannot delete comments
  • Users cannot react to comments (reactions are displayed but not interactive)
// Make comments readonly
CommentsEntry::make()
->readonly()
->mentionables(User::all())

CommentsAction::make()
->readonly()
->mentionables(User::all())

CommentsTableAction::make()
->readonly()
->mentionables(User::all())

// You can also conditionally enable readonly mode
CommentsAction::make()
->readonly(auth()->user()->cannot('create', Comment::class))
->mentionables(User::all())

This is useful for scenarios like:

  • Archived or closed records where no further comments should be allowed
  • View-only access for certain user roles
  • Historical comment viewing
  • Audit trails where comments should be preserved but not modified