- CanComment trait replaces IsCommenter - Commentator interface replaces Commenter - Models moved to Models\ namespace (Comment, Reaction, Attachment, Subscription) - commenter_type/commenter_id columns replace user_type/user_id - CommentsConfig replaces Config class - table_names config key replaces tables - getCommentDisplayName() replaces getCommentName()
2.5 KiB
2.5 KiB
title, description, navigation, seo
| title | description | navigation | seo | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Installation | Get started with Comments in minutes. |
|
|
Requirements
- PHP: 8.2+
- Laravel: 12+
- Filament: 4.x / 5.x
- Livewire: 3.5+ / 4.x
Quick Setup
::steps
Install Package
composer require relaticle/comments
Publish and Run Migrations
php artisan vendor:publish --tag=comments-migrations
php artisan migrate
Include CSS Assets
Prerequisite: You need a custom Filament theme to include the Comments styles.
::alert{type="warning"} If you haven't set up a custom theme for Filament, follow the Filament Docs first. ::
Add the plugin's views to your theme CSS file:
@source "../../../../vendor/relaticle/comments/resources/views/**/*.blade.php";
Register the Plugin
use Relaticle\Comments\CommentsPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
CommentsPlugin::make(),
]);
}
Set Up Your Models
Add the HasComments trait to any model you want to comment on:
use Relaticle\Comments\Concerns\HasComments;
use Relaticle\Comments\Contracts\Commentable;
class Project extends Model implements Commentable
{
use HasComments;
}
Add the CanComment trait to your User model:
use Relaticle\Comments\Concerns\CanComment;
use Relaticle\Comments\Contracts\Commentator;
class User extends Authenticatable implements Commentator
{
use CanComment;
}
Add to Your Resources
Use the slide-over action on view or edit pages:
use Relaticle\Comments\Filament\Actions\CommentsAction;
protected function getHeaderActions(): array
{
return [
CommentsAction::make(),
];
}
::
Done! Visit your Filament panel to see comments in action.
Optional Configuration
| Command | Action |
|---|---|
php artisan vendor:publish --tag=comments-config |
Publish the configuration file |
php artisan vendor:publish --tag=comments-views |
Publish the Blade views for customization |
php artisan vendor:publish --tag=comments-translations |
Publish the translation files |