### Install Commentions Package and Publish Migrations Source: https://context7.com/kirschbaum-development/commentions/llms.txt Install the package via Composer, then publish and run the migrations to create the necessary database tables. Optional configuration and language files can also be published. ```bash composer require kirschbaum-development/commentions php artisan vendor:publish --tag="commentions-migrations" php artisan migrate # Optional: publish config and language files php artisan vendor:publish --tag="commentions-config" php artisan vendor:publish --tag="commentions-lang" ``` -------------------------------- ### Install JavaScript Dependencies with npm Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Use this command to install frontend JavaScript dependencies. ```bash npm install ``` -------------------------------- ### Install PHP Dependencies with Composer Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Use this command to install PHP dependencies for the project. ```bash composer install ``` -------------------------------- ### Install Commentions Package Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Use Composer to install the Commentions package. This is the first step to integrate comment functionality into your application. ```bash composer require kirschbaum-development/commentions ``` -------------------------------- ### Implement HasName for Commenter Name Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Implement the Filament `HasName` interface to customize how commenter names are rendered. This example shows formatting the name with the user's ID. ```php use Filament\Models\Contracts\HasName; use Kirschbaum\Commentions\Contracts\Commenter; class User extends Model implements Commenter, HasName { public function getFilamentName(): string { return (string) '#' . $this->id . ' - ' . $this->name; } } ``` -------------------------------- ### Handle User Subscribed to Commentable Event Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Listen for the `UserIsSubscribedToCommentableEvent` to send custom notifications when a new comment is created. This example uses a `NewCommentNotification`. ```php namespace App\Listeners; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use App\Notifications\NewCommentNotification; use Kirschbaum\Commentions\Events\UserIsSubscribedToCommentableEvent; class SendSubscribedUserNotification implements ShouldQueue { use InteractsWithQueue; public function handle(UserIsSubscribedToCommentableEvent $event): void { $event->user->notify( new NewCommentNotification($event->comment) ); } } ``` -------------------------------- ### Implement HasAvatar for Commenter Avatar Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Ensure your User model implements Filament's `HasAvatar` interface to configure commenter avatars. This example returns the user's avatar URL. ```php use Filament\Models\Contracts\HasAvatar; class User extends Authenticatable implements Commenter, HasName, HasAvatar { public function getFilamentAvatarUrl(): ?string { return $this->avatar_url; } } ``` -------------------------------- ### Register Comments Entry in Filament Infolists Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Add the `CommentsEntry` component to your Filament Infolists to display comments. This example shows how to make users mentionable within the comments. ```php CommentsEntry::make('comments') ->mentionables(fn (Model $record) => User::all()), ``` -------------------------------- ### Get Mentioned Commenters Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Retrieve a collection of Commenter objects that were mentioned in a given comment. You can then iterate over this collection to perform actions. ```php $comment->getMentioned()->each(function (Commenter $commenter) { // do something with $commenter... }); ``` -------------------------------- ### Override Comment Translations Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Override specific translation keys for comments by editing the `lang/vendor/commentions/{locale}/comments.php` file. This example shows English overrides. ```php // lang/vendor/commentions/en/comments.php return [ 'label' => 'Notes', 'no_comments_yet' => 'No notes yet.', 'add_reaction' => 'Add a reaction', 'cancel' => 'Close', 'delete' => 'Remove', 'save' => 'Update', ]; ``` -------------------------------- ### Build Frontend Assets for Production Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Build frontend assets optimized for production. ```bash npm run build ``` -------------------------------- ### Build Frontend Assets for Development Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Build frontend assets in development mode with watch mode enabled. ```bash npm run dev ``` -------------------------------- ### Build CSS Assets for Production Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Build CSS assets optimized for production. ```bash npm run build:styles ``` -------------------------------- ### Build JavaScript Assets for Production Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Build JavaScript assets optimized for production. ```bash npm run build:scripts ``` -------------------------------- ### Build CSS Assets in Development Mode Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Build CSS assets in development mode with watch enabled. ```bash npm run dev:styles ``` -------------------------------- ### Perform Static Analysis Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Run static analysis tools to catch potential issues. ```bash composer static-analysis ``` -------------------------------- ### Build JavaScript Assets in Development Mode Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Build JavaScript assets in development mode with watch enabled. ```bash npm run dev:scripts ``` -------------------------------- ### Configure Commentions Package - PHP Source: https://context7.com/kirschbaum-development/commentions/llms.txt Customize global settings for authentication, comment URLs, and TipTap CSS classes using the static `Config` class. These configurations are typically set in `AppServiceProvider::boot()`. ```php use Kirschbaum\Commentions\Config; // Use a non-default auth guard Config::resolveAuthenticatedUserUsing( fn () => auth()->guard('api')->user() ); // Generate deep-link URLs for mention notification emails Config::resolveCommentUrlUsing(function (Comment $comment): string { return route('projects.show', $comment->commentable) . '#comment-' . $comment->getId(); }); // Override TipTap editor CSS globally Config::resolveTipTapCssClassesUsing(function (): string { return 'prose max-w-none focus:outline-none p-4 min-h-[100px]'; }); // Check Livewire version compatibility Config::isLivewireV4(); // bool — used internally for component prefix Config::getComponentPrefix(); // "commentions." (v4) or "commentions::" (v3) ``` -------------------------------- ### Publish Commentions Migrations Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Run this Artisan command to publish the necessary database migrations for the Commentions package. Ensure you have configured your database connection. ```bash php artisan vendor:publish --tag="commentions-migrations" ``` -------------------------------- ### Publish Commentions Language Files Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Publish the package's translation files to your application using the `vendor:publish` Artisan command. ```bash php artisan vendor:publish --tag="commentions-lang" ``` -------------------------------- ### Enable Mention Notifications in Config Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Configure Commentions to enable built-in notifications for user mentions. Specify the notification channels to use. ```php 'notifications' => [ 'mentions' => [ 'enabled' => true, 'channels' => ['mail', 'database'], ], ], ``` -------------------------------- ### Run Pest PHP Tests Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Execute all tests using the Pest testing framework. ```bash ./vendor/bin/pest ``` -------------------------------- ### Check Code Style with Composer Lint Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Run code style checks to ensure consistency. ```bash composer lint:check ``` -------------------------------- ### Configure Allowed Reactions Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Customize the available reactions by updating the `allowed` option in `config/commentions.php`. ```php 'reactions' => [ 'allowed' => ['👍', '❤️', '😂', '🎉', '👀'], ], ``` -------------------------------- ### Publish Commentions Configuration File Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Publish the commentions configuration file to your application's config directory using the provided Artisan command. This allows for customization of package settings. ```bash php artisan vendor:publish --tag="commentions-config" ``` -------------------------------- ### Config Class - Global Resolvers Source: https://context7.com/kirschbaum-development/commentions/llms.txt Provides static methods to customize global settings such as authentication, comment URLs, and TipTap CSS classes. ```APIDOC ## Config Class — Global Resolvers **Customise authentication, URLs, and TipTap styles globally** The static `Config` class provides hooks that override default package behaviour throughout the application lifecycle, typically called in `AppServiceProvider::boot()`. ```php use Kirschbaum\Commentions\Config; // Use a non-default auth guard Config::resolveAuthenticatedUserUsing( fn () => auth()->guard('api')->user() ); // Generate deep-link URLs for mention notification emails Config::resolveCommentUrlUsing(function (Comment $comment): string { return route('projects.show', $comment->commentable) . '#comment-' . $comment->getId(); }); // Override TipTap editor CSS globally Config::resolveTipTapCssClassesUsing(function (): string { return 'prose max-w-none focus:outline-none p-4 min-h-[100px]'; }); // Check Livewire version compatibility Config::isLivewireV4(); // bool — used internally for component prefix Config::getComponentPrefix(); // "commentions." (v4) or "commentions::" (v3) ``` ``` -------------------------------- ### Manage Subscriptions Directly in PHP Source: https://context7.com/kirschbaum-development/commentions/llms.txt Manage user subscriptions to records directly within a controller or Livewire component. Allows subscribing, unsubscribing, and checking subscription status. ```php // In a controller or Livewire component — manage subscriptions directly $project = Project::find(1); $user = auth()->user(); $project->subscribe($user); echo $project->isSubscribed($user) ? 'Watching' : 'Not watching'; $project->getSubscribers()->each(fn ($u) => dump($u->name)); $project->unsubscribe($user); ``` -------------------------------- ### Configure Built-in Mention Notifications Source: https://context7.com/kirschbaum-development/commentions/llms.txt Configuration for enabling and customizing mention notifications, including channels and mail subject. ```php // config/commentions.php 'notifications' => [ 'mentions' => [ 'enabled' => true, // COMMENTIONS_NOTIFICATIONS_MENTIONS_ENABLED=true 'channels' => ['mail', 'database'], // COMMENTIONS_NOTIFICATIONS_MENTIONS_CHANNELS=mail,database 'mail' => [ 'subject' => 'You were mentioned in a comment', ], ], ], ``` -------------------------------- ### Listen for User Mentioned Event Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Implement this listener to handle the UserWasMentionedEvent. It sends a notification to the mentioned user. Ensure the listener is registered in your EventServiceProvider if auto-discovery is not enabled. ```php namespace App\Listeners; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use App\Notifications\UserMentionedInCommentNotification; use Kirschbaum\Commentions\Events\UserWasMentionedEvent; class SendUserMentionedNotification implements ShouldQueue { use InteractsWithQueue; public function handle(UserWasMentionedEvent $event): void { $event->user->notify( new UserMentionedInCommentNotification($event->comment) ); } } ``` -------------------------------- ### Commentions Configuration Reference Source: https://context7.com/kirschbaum-development/commentions/llms.txt Full configuration options for `config/commentions.php`, covering table names, models, reactions, subscriptions, and notifications. ```php use Kirschbaum\Commentions\Comment; use Kirschbaum\Commentions\Listeners\SendUserMentionedNotification; use Kirschbaum\Commentions\Notifications\UserMentionedInComment; use Kirschbaum\Commentions\Policies\CommentPolicy; return [ 'tables' => [ 'comments' => 'comments', 'comment_reactions' => 'comment_reactions', 'comment_subscriptions' => 'comment_subscriptions', ], 'commenter' => [ 'model' => \App\Models\User::class, // Override if User lives elsewhere ], 'comment' => [ 'model' => Comment::class, 'policy' => CommentPolicy::class, ], 'reactions' => [ 'allowed' => ['👍', '❤️', '😂', '😮', '😢', '🤔'], ], 'subscriptions' => [ 'dispatch_as_mention' => false, // env: COMMENTIONS_SUBSCRIPTIONS_DISPATCH_AS_MENTION 'show_subscribers' => true, // env: COMMENTIONS_SUBSCRIPTIONS_SHOW_SUBSCRIBERS 'show_sidebar' => true, // env: COMMENTIONS_SUBSCRIPTIONS_SHOW_SIDEBAR 'auto_subscribe_on_comment' => true, // env: COMMENTIONS_SUBSCRIPTIONS_AUTO_SUBSCRIBE_ON_COMMENT 'auto_subscribe_on_mention' => true, // env: COMMENTIONS_SUBSCRIPTIONS_AUTO_SUBSCRIBE_ON_MENTION ], 'notifications' => [ 'mentions' => [ 'enabled' => false, // env: COMMENTIONS_NOTIFICATIONS_MENTIONS_ENABLED 'channels' => ['mail'], // env: COMMENTIONS_NOTIFICATIONS_MENTIONS_CHANNELS 'listener' => SendUserMentionedNotification::class, 'notification' => UserMentionedInComment::class, 'mail' => [ 'subject' => 'You were mentioned in a comment', ], ], ], ]; ``` -------------------------------- ### Convert HTML to Markdown with Mentions Source: https://context7.com/kirschbaum-development/commentions/llms.txt Converts TipTap HTML output to Markdown. Optionally, custom handlers can transform mentions into different formats like Slack's user IDs. ```php use Kirschbaum\Commentions\Actions\HtmlToMarkdown; $html = '
Hey @Alice, check this out!
'; // Default: mentions become *@Alice* $markdown = HtmlToMarkdown::run($html); // "Hey *@Alice*, check this out!" // Custom mention handler (e.g., Slack-style user IDs) $markdown = HtmlToMarkdown::run($html, function (string $id, string $label): string { return "<@U{$id}>"; // Slack mention format }); // "Hey <@U5>, check this out!" ``` -------------------------------- ### Implement Commenter Interface in User Model Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Your User model must implement the `Commenter` interface from the Commentions package to enable user mention functionality. Ensure the `use` statement is present. ```php use Kirschbaum\Commentions\Contracts\Commenter; class User extends Model implements Commenter { // ... } ``` -------------------------------- ### Handle User Mentioned Event Listener Source: https://context7.com/kirschbaum-development/commentions/llms.txt Listens for the `UserWasMentionedEvent` to notify the mentioned user. ```php // app/Listeners/HandleUserMentioned.php use Kirschbaum\Commentions\Events\UserWasMentionedEvent; class HandleUserMentioned implements ShouldQueue { public function handle(UserWasMentionedEvent $event): void { $event->user->notify(new YouWereMentionedNotification($event->comment)); } } ``` -------------------------------- ### Apply Code Style Fixes with Composer Lint Source: https://github.com/kirschbaum-development/commentions/blob/main/CLAUDE.md Automatically apply code style fixes to the project. ```bash composer lint ``` -------------------------------- ### Filament SubscriptionAction for Subscribe/Unsubscribe Source: https://context7.com/kirschbaum-development/commentions/llms.txt Implement SubscriptionAction to allow users to subscribe or unsubscribe from commentable records. Customize labels and icons for subscribe and unsubscribe states. This action works for header, record, and table actions. ```php use Kirschbaum\Commentions\Filament\Actions\SubscriptionAction; use Kirschbaum\Commentions\Filament\Actions\SubscriptionTableAction; // Header action protected function getHeaderActions(): array { return [ SubscriptionAction::make() ->subscribeLabel('Watch project') ->unsubscribeLabel('Stop watching') ->subscribeIcon('heroicon-o-eye') ->unsubscribeIcon('heroicon-o-eye-slash'), ]; } // Filament 4 record action ->recordActions([ SubscriptionAction::make(), ]) // Filament 3 table action ->actions([ SubscriptionTableAction::make(), ]) ``` -------------------------------- ### Programmatic Comment Creation with SaveComment Source: https://context7.com/kirschbaum-development/commentions/llms.txt Create comments programmatically using SaveComment::run(). This action enforces policies, persists comments, fires events, handles mentions, auto-subscribes users, and notifies subscribers. It returns the created comment object. ```php use Kirschbaum\Commentions\Actions\SaveComment; use Kirschbaum\Commentions\Comment; use Illuminate\Auth\Access\AuthorizationException; $project = Project::findOrFail(42); $bot = User::where('email', 'bot@example.com')->first(); try { // Body is stored as TipTap HTML; plain-text is fine too $comment = SaveComment::run( commentable: $project, author: $bot, body: 'Deployment finished successfully at ' . now()->toTimeString(), ); echo $comment->getId(); // int primary key echo $comment->getAuthorName(); // "bot" echo $comment->getBody(); // raw HTML body echo $comment->getParsedBody(); // HTML with mention spans styled echo $comment->body_markdown; // Markdown version via HtmlToMarkdown } catch (AuthorizationException $e) { // Thrown when the policy's create() returns false logger()->error('Bot cannot post comments', ['error' => $e->getMessage()]); } ``` -------------------------------- ### Comment Model - Key Methods Source: https://context7.com/kirschbaum-development/commentions/llms.txt Provides methods for interacting with an existing Comment record, including reading content, managing reactions, and extracting mentions. ```APIDOC ## Comment Model - Key Methods **Interact with an existing Comment record** The `Comment` Eloquent model implements `RenderableComment` and exposes helpers for reading content, managing reactions, and extracting mentions. ```php $comment = Comment::with('reactions.reactor', 'author')->find(7); // Reading content $comment->getBody(); // raw TipTap HTML $comment->getParsedBody(); // HTML with styled mention spans $comment->body_markdown; // Markdown string (computed attribute) $comment->body_parsed; // alias for getParsedBody() as attribute $comment->getAuthorName(); // author's display name $comment->getAuthorAvatar(); // URL or ui-avatars.com fallback $comment->getCreatedAt(); // Carbon instance $comment->isAuthor($user); // bool — is $user the author? // Mentions $comment->getMentioned()->each(function (Commenter $user) { // Collection of Commenter instances referenced in body via data-id spans Mail::to($user)->send(new MentionMail($comment)); }); // Custom mention transformation when converting to Markdown $markdown = $comment->getBodyMarkdown(function (string $id, string $label): string { return "[@{$label}](https://example.com/users/{$id})"; }); // Reactions $comment->toggleReaction('👍'); // adds or removes the reaction for auth user $comment->reactions; // HasMany relation ``` ``` -------------------------------- ### Wrap Comments Entry in Filament Section (Filament 3) Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md For Filament 3, use ` Filament Infolists Components Section` to visually group the comments entry within your infolist. ```php \Filament\Infolists\Components\Section::make('Comments') ->schema([ CommentsEntry::make('comments'), ]), ``` -------------------------------- ### Handle Comment Reaction Event Listener Source: https://context7.com/kirschbaum-development/commentions/llms.txt Listens for the `CommentWasReactedEvent` to log reaction details. ```php // app/Listeners/HandleReaction.php use Kirschbaum\Commentions\Events\CommentWasReactedEvent; class HandleReaction { public function handle(CommentWasReactedEvent $event): void { logger('Reaction added', [ 'comment_id' => $event->comment->getId(), 'reaction' => $event->reaction->reaction, ]); } } ``` -------------------------------- ### Wrap Comments Entry in Filament Section (Filament 4) Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md For Filament 4, use ` Filament Schemas Components Section` to visually group the comments entry within your infolist. ```php \Filament\Schemas\Components\Section::make('Comments') ->components([ CommentsEntry::make('comments'), ]), ``` -------------------------------- ### Enable Polling for New Comments Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Enable real-time polling for new comments on a component by calling the `poll` method with the desired interval. This is useful for keeping comment sections up-to-date. ```php Infolists\Components\Section::make('Comments') ->schema([ CommentsEntry::make('comments') ->poll('10s') ]), ``` -------------------------------- ### Implement Commenter Interface on User Model Source: https://context7.com/kirschbaum-development/commentions/llms.txt Mark your User model as a commenter by implementing the `Commenter` contract. Optionally implement `HasName` and `HasAvatar` for custom display names and avatars in the comment UI. ```php use FilamentleauContracts\u0002HasAvatar; use FilamentleauContracts\u0002HasName; use Kirschbaum\u0002Commentions\u0002Contracts\u0002Commenter; class User extends Authenticatable implements Commenter, HasName, HasAvatar { // Custom display name shown in @mention suggestions and comment headers public function getFilamentName(): string { return '#' . $this->id . ' - ' . $this->name; } // Avatar URL; falls back to ui-avatars.com initials if null public function getFilamentAvatarUrl(): ?string { return $this->avatar_url; } } ``` -------------------------------- ### Configure Comment Pagination in Filament Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Control comment pagination within Filament using the `CommentsAction` or `CommentsEntry`. Set `perPage` to define items per page, `loadMoreIncrementsBy` for appended items, and `loadMoreLabel` for the button text. Use `disablePagination()` to turn off pagination entirely. ```php use Kirschbaum\Commentions\Filament\Actions\CommentsAction; ->recordActions([ CommentsAction::make() ->mentionables(User::all()) ->perPage(10) ]) ``` ```php use Kirschbaum\Commentions\Filament\Actions\CommentsAction; ->recordActions([ CommentsAction::make() ->mentionables(User::all()) ->disablePagination(); ]) ``` ```php use Kirschbaum\Commentions\Filament\Infolists\Components\CommentsEntry; Infolists\Components\Section::make('Comments') ->schema([ CommentsEntry::make('comments') ->mentionables(fn (Model $record) => User::all()) ->perPage(8) ->loadMoreIncrementsBy(8) ->loadMoreLabel('Show older'), ]) ``` -------------------------------- ### Add SubscriptionAction in Filament Header Actions Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Include the `SubscriptionAction` in your Filament resource's header actions to allow users to subscribe or unsubscribe from comment notifications. ```php use Kirschbaum\Commentions\Filament\Actions\SubscriptionAction; // In header actions protected function getHeaderActions(): array { return [ SubscriptionAction::make(), ]; } ``` -------------------------------- ### Create Custom Comment Policy Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Implement a custom policy by extending `Kirschbaum\Commentions\Policies\CommentPolicy` and defining `create`, `update`, and `delete` methods for custom permission logic. Register this policy in `config/commentions.php` under the `comment.policy` option. ```php namespace App\Policies; use Kirschbaum\Commentions\Comment; use Kirschbaum\Commentions\Contracts\Commenter; use Kirschbaum\Commentions\Policies\CommentPolicy as CommentionsPolicy; class CommentPolicy extends CommentionsPolicy { public function create(Commenter $user): bool { // TODO: Implement custom permission logic. } public function update($user, Comment $comment): bool { // TODO: Implement custom permission logic. } public function delete($user, Comment $comment): bool { // TODO: Implement custom permission logic. } } ``` ```php 'comment' => [ // ... 'policy' => \App\Policies\CommentPolicy::class, ], ``` -------------------------------- ### Manage Subscriptions Programmatically with HasComments Trait Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Utilize the `HasComments` trait methods to subscribe, unsubscribe, check subscription status, or retrieve all subscribers for a commentable entity. These methods provide direct control over user subscriptions. ```php // Subscribe a user $commentable->subscribe($user); ``` ```php // Unsubscribe a user $commentable->unsubscribe($user); ``` ```php // Check if a user is subscribed $isSubscribed = $commentable->isSubscribed($user); ``` ```php // Get all subscribers $subscribers = $commentable->getSubscribers(); ``` -------------------------------- ### Customize TipTap Editor CSS Classes Globally Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Globally customize the CSS classes used by the TipTap editor by resolving them using `Config::resolveTipTapCssClassesUsing`. ```php use Kirschbaum\Commentions\Config; Config::resolveTipTapCssClassesUsing(function () { return 'prose max-w-none focus:outline-none p-4'; }); ``` -------------------------------- ### Resolve Authenticated User Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Customize the resolver for the authenticated user if you are not using the default `auth()->user()`. This allows specifying a custom authentication guard. ```php use Kirschbaum\Commentions\Config; Config::resolveAuthenticatedUserUsing( fn () => auth()->guard('my-guard')->user() ) ``` -------------------------------- ### Add CommentsAction as a Header Action Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Display a comment action in the header of your Filament resource pages. This provides a prominent place for users to initiate or view comments. ```php use Kirschbaum\Commentions\Filament\Actions\CommentsAction; protected function getHeaderActions(): array { return [ CommentsAction::make(), ]; } ``` -------------------------------- ### Control Livewire Commentions Component Properties Source: https://github.com/kirschbaum-development/commentions/blob/main/README.md Control the visibility of the subscription sidebar and the subscribers list within the Livewire commentions component. Set `sidebar-enabled` to false to hide the entire sidebar, or `show-subscribers` to false to hide only the subscribers list. ```php