alfasix / alfakit-comments
Comments with mentions, reactions and notifications on any record of an AlfaKit panel: an infolist entry, a slide-over action, a table action and a polling widget.
Requires
- php: ^8.4
- alfasix/alfakit: ^0.2|@dev
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
by Alfa Six
This is a read-only split of the AlfaKit monorepo. Please open issues and pull requests there.
Comments with @ mentions, emoji reactions and notifications on any record of an AlfaKit panel, in the spirit of Filament's Commentions. It renders in React, Vue and Svelte with AlfaKit's built-in components.
Installation
composer require alfasix/alfakit-comments php artisan vendor:publish --tag=alfakit-comments-migrations php artisan migrate
Mention notifications use Laravel's notifications table (php artisan make:notifications-table) and show in the panel's bell with ->databaseNotifications().
Register
use AlfaSix\AlfakitComments\CommentsPlugin; $panel->plugin( CommentsPlugin::make() ->reactions(['👍', '❤️', '😄', '🎉']) ->newestFirst() ->perPage(10), );
use AlfaSix\AlfakitComments\Concerns\HasComments; use AlfaSix\AlfakitComments\Concerns\IsCommenter; use AlfaSix\AlfakitComments\Contracts\Commentable; use AlfaSix\AlfakitComments\Contracts\Commenter; class Ticket extends Model implements Commentable { use HasComments; } class User extends Authenticatable implements Commenter { use IsCommenter; }
Usage
use AlfaSix\AlfakitComments\Actions\CommentsAction; use AlfaSix\AlfakitComments\Actions\CommentsTableAction; use AlfaSix\AlfakitComments\Infolists\Components\CommentsEntry; use AlfaSix\AlfakitComments\Widgets\CommentsWidget; // Infolist (view page), or a form (edit page) Section::make('Comments')->schema([CommentsEntry::make()]); // Header action: the comments in a slide-over CommentsAction::make(); // Table row action $table->recordActions([CommentsTableAction::make()]); // A polling feed in a record page's footer widgets protected function getFooterWidgets(): array { return [CommentsWidget::class]; } // From code $ticket->comment('<p>Done!</p>', $user);
See the documentation for every option, the events and the policy.
License
MIT. See LICENSE.md.