Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Commentable

Commentable Laravel Package

modularavel/commentable

A Laravel package that adds comment functionality to any Eloquent model through polymorphic relationships. It provides migrations, configurable commentable models, and a simple API for creating, retrieving, and managing comments in your application.

View on GitHub
Deep Wiki
Context7

Laravel commentable threads

Frequently asked questions about Commentable
How do I install modularavel/commentable in a Laravel app?
Install modularavel/commentable with Composer, then publish any package assets if the README instructs you to and run the migrations. After that, configure the models that should be commentable and use the package API to create comments. Always follow the installation steps in the repository README for your Laravel version.
Can I add comments to any Eloquent model with modularavel/commentable?
Yes. The package is built around polymorphic relationships, so comments can be attached to any Eloquent model you designate as commentable. You configure the commentable models rather than being limited to a single built-in type.
How does the polymorphic relationship work in modularavel/commentable?
Comments are stored through a polymorphic relationship, meaning a comment record references both a commentable model type and its key. That lets one comments table serve multiple Eloquent models without separate tables for each. The package provides the migrations needed for this structure.
Do I need to publish and run migrations for modularavel/commentable?
Yes, the package provides migrations, so you should publish them if needed and run php artisan migrate. In tests, run the migrations against your test database before creating comments. Verify the exact publish tag and migration steps in the README.
How do I create and retrieve comments with modularavel/commentable?
Use the package's simple API to create comments against a model you have made commentable, and retrieve them through the corresponding relationship or package methods. The exact method names and examples are documented in the README, so follow those for your version. This keeps comment creation and retrieval consistent with the package's polymorphic design.
Can I configure which models are commentable in modularavel/commentable?
Configuration lets you define which models are commentable, and the package uses configurable commentable models rather than hard-coding a single target. Check the package config file after publishing to see the available options. If you need a custom comment model, confirm the supported configuration in the README.
Does modularavel/commentable support threaded or nested comments?
The package is described as providing Laravel commentable threads, so threading is part of its intended use case. Check the README and configuration for how replies or nesting are represented and whether you need to enable anything. For complex nesting requirements, confirm the behavior against your application's needs before adopting it.
Which Laravel versions does modularavel/commentable support?
The supported Laravel versions are defined by the package's Composer constraints, so check composer.json and the README for the authoritative list. Install it in a project that matches those constraints, and avoid assuming support for a Laravel release that is not listed. This is especially important when evaluating it for an existing application.
How should I test comments in a Laravel app using modularavel/commentable?
Test by running the package migrations in your test database, creating a commentable model instance, and asserting that comments are created and retrieved through the polymorphic relationship. Use Laravel's testing tools and database refresh traits so each test starts clean. Also assert authorization or validation rules you add around comment creation.
Is modularavel/commentable maintained for production, and what alternatives exist?
Check the GitHub repository and Packagist for recent releases, open issues, and Laravel version constraints before using it in production. For production, review the migrations, database indexes, and how you validate and authorize comment creation. Alternatives include other Laravel comment packages or a small custom polymorphic comments implementation, depending on whether you need threading, moderation, or custom comment models.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource