bergstar/chat-field provides a Filament 5 form field that renders a record-attached chat window directly inside a form. It stores a single thread per owner record, supports message text and file attachments, and automatically resolves the deepest saved singular relationship record when the field is nested inside a relationship section.
You can install the package via composer:
composer require bergstar/chat-fieldIf you use Filament Panels with a custom theme, add the package views to your theme CSS:
@source '../../../../vendor/bergstar/chat-field/resources/**/*.blade.php';Publish the package assets:
php artisan vendor:publish --tag="chat-field-config"
php artisan vendor:publish --tag="chat-field-migrations"Then run your migrations:
php artisan migrateAdd the field to any Filament form:
use Toolborg\ChatField\ChatField;
ChatField::make('chat')For nested singular relationships, add it inside a relationship layout component:
use Filament\Schemas\Components\Section;
use Toolborg\ChatField\ChatField;
Section::make('Meta')
->relationship('meta')
->schema([
ChatField::make('chat'),
])Behavior:
- One thread is stored per owner record.
- The current authenticated user becomes the message author.
- If the owner record does not exist yet, the field renders a save-first state instead of attaching to the wrong model.
- Nested singular relationship sections use the deepest saved record in the chain.
The config file lets you override:
- thread and message model classes
- author display name column
- messages per page
- upload disk, directory, visibility, mime types, and size limits
Default shape:
return [
'author_name_column' => 'name',
'messages_per_page' => 10,
'uploads' => [
'disk' => 'public',
'directory' => 'chat-field-attachments',
'visibility' => 'public',
'max_file_size' => 12288,
'max_files' => 10,
],
];composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.