Comments
CommunityAdd comments to your Filament resources.
Author:
Parallax
Package health
BetaAutomated checks of this plugin's Composer package
15 checks
- Skipped: GitHub Actions pinned to SHA
- Skipped: GitLab CI includes pinned to SHA
- Passed: Open security advisories
- Failed: Dependabot PR responsiveness — Stale Dependabot PRs: oldest security PR is 115 days old; oldest general PR is 147 days old. View details on Plumb
- Skipped: Renovate MR responsiveness
- Failed: Dependabot or Renovate configured — No dependency updater configuration found. View details on Plumb
- Skipped: Dependency update cooldown configured
- Failed: Provides a security policy — View details on Plumb
- Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
- Passed: Commit and release recency — Active: last commit 40 days ago; last release 40 days ago.
-
Passed:
composer.lock not committed by library
—
composer.lockis absent from the released dist archive. - Passed: Dist archive is lean
-
Passed:
Current Laravel version supported
—
Package dependencies resolve together with current Laravel
13.0. -
Passed:
Current PHP version supported
—
Constraint
^8.1supports current PHP8.5. - Skipped: Current Symfony version supported
filament/
namespace. Review the source and install at your own risk. Found
malware or an unresolved security issue the author won't
address?
Report it
.
Documentation
Add comments to your Filament Resources.
#Installation
Install the package via composer:
composer require parallax/filament-comments
Publish and run the migrations:
php artisan vendor:publish --tag="filament-comments-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="filament-comments-config"
You can publish the language files with:
php artisan vendor:publish --tag="filament-comments-translations"
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-comments-views"
#Quickstart
#1. Add model trait
First open the eloquent model you wish to add Filament Comments to.
namespace App\Models;
use Parallax\FilamentComments\Models\Traits\HasFilamentComments;
class Product extends Model
{
use HasFilamentComments;
}
#2. Add comments to Filament Resource
There are 3 ways of using this plugin in your Filament Resources:
#1. Page actions
Open the page where you want the comments action to appear, this will most likely be the ViewResource page.
Add the CommentsAction to the getHeaderActions() method.
<?php
namespace App\Filament\Resources\ProductResource\Pages;
use Parallax\FilamentComments\Actions\CommentsAction;
class ViewProduct extends ViewRecord
{
protected function getHeaderActions(): array
{
return [
CommentsAction::make(),
];
}
}
You may customise the page action as you would any other action.
#2. Table actions
Open the resource where you want the comments table action to appear.
Add the CommentsAction to the $table->actions() method.
<?php
namespace App\Filament\Resources;
use Parallax\FilamentComments\Tables\Actions\CommentsAction;
class ProductResource extends Resource
{
public static function table(Table $table): Table
{
return $table
->actions([
CommentsAction::make(),
]);
}
}
You may customise the table action as you would any other action.
#3. Infolist entry
It's also possible to use the comments component within your infolist.
Add the CommentsEntry to the $infolist->schema() method.
<?php
namespace App\Filament\Resources;
use Parallax\FilamentComments\Infolists\Components\CommentsEntry;
class ProductResource extends Resource
{
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
CommentsEntry::make('filament_comments'),
]);
}
}
Please note that this cannot be used in combination with a comments action on the same page.
#Authorisation
By default, all users can view & create comments as well as only delete their own comments.
If you would like to change this behaviour you can create your own eloquent model policy for the Parallax\FilamentComments\Models\FilamentComment model.
You should define the policy class in the filament-comments config file.
return [
'model_policy' => \Parallax\FilamentComments\Policies\FilamentCommentPolicy::class,
];
#Pruning deleted comments
Comment records are set to be pruned after 30 days of being soft-deleted by default. You may change this value in the config file:
return [
'prune_after_days' => 30,
];
After configuring the model, you should schedule the model:prune Artisan command in your application's Kernel class. Don't forget to explicitly mention the FilamentComment class. You are free to choose the appropriate interval at which this command should be run:
namespace App\Console;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Parallax\FilamentComments\Models\FilamentComment;
class Kernel extends ConsoleKernel
{
protected function schedule(Schedule $schedule)
{
$schedule->command('model:prune', [
'--model' => [FilamentComment::class],
])->daily();
// This will not work, as models in a package are not used by default
// $schedule->command('model:prune')->daily();
}
}
#Changelog
Please see CHANGELOG for more information on what has changed recently.
#Credits
#License
The MIT License (MIT). Please see License File for more information.
The author
From the same author
Featured Plugins
A selection of plugins curated by the Filament team
Custom Dashboards
Let your users build and share their own dashboards with a drag-and-drop interface. Define your data sources in PHP and let them do the rest.
Filament
Blueprint
Filament Blueprint is a premium Laravel Boost extension that helps AI agents produce accurate, detailed implementation plans and security reports for Filament apps.
Filament
Advanced Tables (formerly Filter Sets)
Supercharge your tables with powerful features like user-customizable views, quick filters, multi-column sorting, advanced table searching, convenient view management, and more. Compatible with Resource Panel Tables, Relation Managers, Table Widgets, and Table Builder!
Kenneth Sese