phpinnacle / comments
Polymorphic record discussions for Laravel Livewire and Filament.
Requires
- php: ^8.4
- spatie/laravel-package-tools: ^1.92
This package is auto-updated.
Last update: 2026-09-01 15:41:24 UTC
README
Comments provides polymorphic discussion threads for Eloquent records. It includes a Livewire thread, Filament action and infolist entry, comment policy, rich-text toolbar configuration and automatic pruning support.
Features
- Comments attached to any Eloquent model through a morph relation.
- Livewire list and creation form.
- Filament
CommentsActionmodal andCommentsEntryinfolist component. - Author association using a configurable user model.
- Policy-backed access and configurable editor toolbar.
- Configurable database connection and retention period.
Installation
composer require phpinnacle/comments
php artisan vendor:publish --tag="phpinnacle-comments-migrations"
php artisan migrate
Publish configuration or views only when customization is required:
php artisan vendor:publish --tag="phpinnacle-comments-config" php artisan vendor:publish --tag="phpinnacle-comments-views"
Set user.model to the authenticatable model used by the application. prune controls retention in days, while toolbar controls the enabled formatting buttons.
Filament usage
use PHPinnacle\Comments\Actions\CommentsAction; use PHPinnacle\Comments\Infolists\CommentsEntry; CommentsAction::make(); CommentsEntry::make('comments');
Authorization is delegated to CommentPolicy. Register or override the policy when the application's access rules differ. If pruning is desired, schedule Laravel's model:prune command.
Testing
composer test
Changelog and license
See CHANGELOG. Released under the MIT License.