### Install Filament Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/FILAMENT_SETUP.md Run these commands in your Laravel application to install the Filament package and set up the admin panel. ```bash composer require filament/filament:"^4.0" php artisan filament:install --panels ``` -------------------------------- ### Configure Queue Settings Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/NOTIFICATIONS_SETUP.md Set the queue driver in the environment file and start the worker to process notifications asynchronously. ```env QUEUE_CONNECTION=database ``` ```bash php artisan queue:work ``` -------------------------------- ### Install Commentify via Composer Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Use this command to add the package to your Laravel project. ```bash composer require usamamuneerchaudhary/commentify ``` -------------------------------- ### Initialize Database Notifications Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/NOTIFICATIONS_SETUP.md Run these commands to create and migrate the necessary database table for storing notifications. ```bash php artisan notifications:table php artisan migrate ``` -------------------------------- ### Run Package Migrations Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Execute this command to run the necessary database migrations. ```bash php artisan migrate ``` -------------------------------- ### Run test suite Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Executes the project's test suite using Composer. ```bash composer test ``` -------------------------------- ### Configure Theme Mode Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Set the theme preference in the configuration file. ```php 'theme' => 'auto', // Options: 'light', 'dark', 'auto' ``` -------------------------------- ### Configure CSS Framework Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Set the preferred CSS framework in the configuration file. ```php 'css_framework' => 'tailwind', // Options: 'tailwind' or 'bootstrap' ``` -------------------------------- ### Publish Views Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Publish Tailwind or Bootstrap views to the local resources directory for customization. ```bash # Publish Tailwind views php artisan vendor:publish --tag="commentify-tailwind-views" # Publish Bootstrap views php artisan vendor:publish --tag="commentify-bootstrap-views" ``` -------------------------------- ### Publish Package Assets Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Publish configuration, views, language files, or migrations using specific tags. ```bash # Publish configuration file php artisan vendor:publish --tag="commentify-config" # Publish views (choose one based on your CSS framework) php artisan vendor:publish --tag="commentify-tailwind-views" # For Tailwind CSS php artisan vendor:publish --tag="commentify-bootstrap-views" # For Bootstrap 5 # Publish Filament views (framework independent) php artisan vendor:publish --tag="commentify-filament-views" # Publish language files php artisan vendor:publish --tag="commentify-lang" # Publish migrations php artisan vendor:publish --tag="commentify-migrations" ``` -------------------------------- ### Register Service Provider Manually Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Add the provider to bootstrap/providers.php if automatic discovery is not working or for local development. ```php true, 'notification_channels' => ['database'], // or ['database', 'mail', 'broadcast'] ``` -------------------------------- ### Configure Mail Settings Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/NOTIFICATIONS_SETUP.md Define SMTP and sender details in the .env file for mail-based notifications. ```env MAIL_MAILER=smtp MAIL_HOST=mailhog MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="noreply@example.com" MAIL_FROM_NAME="${APP_NAME}" ``` -------------------------------- ### Configure Notification Settings Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Enable notifications and define the active channels for comment events. ```php 'enable_notifications' => true, 'notification_channels' => ['database', 'mail', 'broadcast'], ``` -------------------------------- ### Publish Language Files Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Publish translation files to the local lang directory to modify package strings. ```bash php artisan vendor:publish --tag="commentify-lang" ``` -------------------------------- ### Publish Filament Views Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/FILAMENT_SETUP.md Publish the Commentify Filament views to your local resources directory for customization. ```bash php artisan vendor:publish --tag="commentify-filament-views" ``` -------------------------------- ### Configure Comment Reporting Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Enable the reporting feature and define the list of reasons available to users when flagging comments. ```php 'enable_reporting' => true, // Enable/disable reporting 'report_reasons' => [ // Customize report reasons 'spam', 'inappropriate', 'offensive', 'other' ], ``` -------------------------------- ### Publish Tailwind Configuration Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Publish the package's tailwind.config.js file for Tailwind CSS projects. ```bash php artisan vendor:publish --tag="commentify-tailwind-config" ``` -------------------------------- ### Enable Read-Only Mode Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Set the read_only flag to true in the configuration file to disable all commenting. ```php 'read_only' => true, ``` -------------------------------- ### Configure Comment Sorting Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Set the default sort order and toggle the visibility of the sorting dropdown in the configuration file. ```php 'default_sort' => 'newest', // Default sort order 'enable_sorting' => true, // Show/hide sorting dropdown ``` -------------------------------- ### Enable Emoji Picker Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Toggle the emoji picker feature within the configuration file. ```php 'enable_emoji_picker' => true, ``` -------------------------------- ### Enable Comment Approval Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Toggle the requirement for manual administrator approval for new comments. ```php 'require_approval' => true, // Require manual approval for comments ``` -------------------------------- ### Configure Commentify settings Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Modify the configuration file to adjust routing, model associations, UI frameworks, and feature toggles. ```php return [ 'users_route_prefix' => 'users', // Route prefix for user profiles 'user_model' => \App\Models\User::class, // Use your app's User model for avatars and user-related logic 'pagination_count' => 10, // Number of comments per page 'css_framework' => 'tailwind', // 'tailwind' or 'bootstrap' 'comment_nesting' => true, // Enable/disable nested comments 'read_only' => false, // Enable read-only mode 'default_sort' => 'newest', // Default sort: 'newest', 'oldest', 'most_liked', 'most_replied' 'enable_sorting' => true, // Enable/disable sorting dropdown 'enable_reporting' => true, // Enable/disable comment reporting 'report_reasons' => [ // Predefined report reasons 'spam', 'inappropriate', 'offensive', 'other' ], 'require_approval' => false, // Require manual approval for comments before they appear 'theme' => 'auto', // Theme mode: 'light', 'dark', 'auto' 'enable_emoji_picker' => true, // Enable/disable emoji picker 'enable_notifications' => false, // Enable/disable notifications 'notification_channels' => ['database'], // Notification channels: 'database', 'mail', 'broadcast' ]; ``` -------------------------------- ### Register Commentify Plugin Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/FILAMENT_SETUP.md Add the Commentify plugin to your Filament panel configuration in the AdminPanelProvider. ```php use Filament\\\Panel; use Usamamuneerchaudhary\\\Commentify\\\Filament\\\CommentifyPlugin; public function panel(Panel $panel): Panel { return $panel ->plugin(CommentifyPlugin::make()); } ``` -------------------------------- ### Enable user avatars Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Add the HasUserAvatar trait to the User model and update the configuration to support user-related logic. ```php use Usamamuneerchaudhary\Commentify\Traits\HasUserAvatar; class User extends Model { use HasUserAvatar; } ``` ```php 'user_model' => \App\Models\User::class, ``` -------------------------------- ### Render comments in Blade view Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Use the Livewire component to display the comment section for a specific model instance. ```html ``` -------------------------------- ### Customize Notification Content Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/NOTIFICATIONS_SETUP.md Extend the base notification class to define custom data structures for notifications. ```php use Usamamuneerchaudhary\Commentify\Notifications\CommentPostedNotification; class CustomCommentNotification extends CommentPostedNotification { public function toArray($notifiable): array { return [ // Your custom data ]; } } ``` -------------------------------- ### Implement Notifiable Trait Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/NOTIFICATIONS_SETUP.md Ensure the User model includes the Notifiable trait to support notification delivery. ```php use Illuminate otifications otifiable; class User extends Authenticatable { use Notifiable; // ... } ``` -------------------------------- ### Integrate Commentable trait Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Add the Commentable trait to any Eloquent model to enable comment functionality. ```php use Usamamuneerchaudhary\Commentify\Traits\Commentable; class Article extends Model { use Commentable; } ``` -------------------------------- ### Mark Notifications as Read Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/NOTIFICATIONS_SETUP.md Use these methods to update the read status of notifications in controllers or components. ```php // In a controller or Livewire component auth()->user()->unreadNotifications->markAsRead(); // Or mark specific notification $notification->markAsRead(); ``` -------------------------------- ### Implement User Comment Ban Trait Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Add the HasCommentBan trait to the User model to enable comment banning functionality. ```php use Usamamuneerchaudhary\Commentify\Traits\HasCommentBan; class User extends Authenticatable { use HasCommentBan; } ``` -------------------------------- ### Configure Tailwind v4 Dark Mode Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/README.md Add the dark mode variant to your main CSS file for Tailwind v4. ```css @import "tailwindcss"; @custom-variant dark (&:where(.dark, .dark *)); ``` -------------------------------- ### Display Notifications in Blade Source: https://github.com/usamamuneerchaudhary/commentify/blob/main/NOTIFICATIONS_SETUP.md Iterate through unread notifications to display messages and links in a view. ```blade @foreach(auth()->user()->unreadNotifications as $notification)
{{ $notification->data['message'] }} View Comment
@endforeach ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.