asignua / filament-chat
Internal team chat for Filament 5 panels: direct messages and groups, @mentions, replies, editing, reactions, read receipts, unread counters in navigation, tab title and favicon, a full chat page and a slide-over you can pin next to any page, and record references — drop a link to a panel record and
Requires
- php: ^8.3
- filament/filament: ^5.12
- illuminate/contracts: ^12.0|^13.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- orchestra/testbench: ^10.0|^11.0
- phpunit/phpunit: ^11.5|^12.0|^13.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Team chat for Filament panels. Direct messages and groups, @mentions, editing, reactions, read receipts, a slide-over you can pin next to any page — and messages that point at your panel's records: drag a link to a record into the chat and it becomes a card.
Works with or without a websocket server: turn real-time on with one environment variable (Laravel Reverb, Pusher, Ably), or let the chat poll.
- Screenshots
- Free or Pro? — what the paid Chat Pro adds
- Features
- Requirements
- Installation
- Configuration — users, features, messages, interface, models & tables
- Record references — which records, who sees them, drag & drop, "Discuss in chat"
- Real-time delivery — Reverb, Docker, nginx, Pusher, polling
- Notifications
- Translations — your language, your own wording
- Upgrading to 1.12 — several panels, record conversations (earlier upgrades below it)
- Upgrading to 1.11 — UUID / ULID keys, mute
- Several panels — one panel in the free chat, several with Chat Pro;
panels.home - Record conversations — one conversation per record (Chat Pro)
- Customising — own models, audit trail, events
- Extending — your own window, render hooks, protected methods, the
MessageSent/MessageEditedevents - Integration notes — custom themes, panels built by a package, several panels
- Troubleshooting
- AI agents
- Testing
Free or Pro?
| Chat (free, MIT) | Chat Pro (€69 / €169) | |
|---|---|---|
| Direct messages and groups, @mentions, editing, reactions, replies, read receipts | ✓ | ✓ |
| Chat page, top-bar slide-over that can be pinned next to any page, unread counters and bell | ✓ | ✓ |
| Record references: drop a link to a panel record and it becomes a card | ✓ | ✓ |
| Real time over Reverb / Pusher / Ably, or polling | ✓ | ✓ |
| Presence: green "online" dot and "last seen", real time or polling | ✓ | ✓ |
| Multi-tenancy: separate chats per Filament tenant (or your own tenancy) | ✓ | ✓ |
| RTL, dark mode, 47 languages | ✓ | ✓ |
| Several chat panels (each with its own people, references and tenancy), shared or per-panel conversations | one panel | ✓ |
| Record conversations: one discussion per record for everyone who may see it, from a button on the record page; read-only for whom you choose, or not opened in a panel | ✓ | |
| Hide read receipts from some people (who sees that whom has read) | ✓ | |
| Moderation: ring moderators about record discussions, send limits, audit events for deletions | ✓ | |
| Retention, record discussions following merged or deleted records, a person's data export | ✓ | |
| File attachments: drag & drop, paperclip, paste a screenshot from the clipboard | ✓ | |
| Image lightbox, one-click file download | ✓ | |
| Delete your own messages | ✓ | |
| "Olga is typing…" indicator | ✓ | |
| Search every message across your conversations | ✓ | |
| New-message sound (built-in chime or your file) | ✓ | |
| Email digest of unread messages | ✓ |
Chat Pro is an add-on: it requires the free package and builds on its extension seams, so conversations and settings carry over.
Screenshots
The Chat page — conversations, reactions, read receipts and record cards:
The slide-over pinned next to a record page, with "Attach current":
@mentions with autocomplete:
Dark mode:
Features
| Conversations | Direct messages (one per pair) and groups: title, members, leave. The creator manages a group; whoever leaves keeps the history up to that moment. A member added to a group — or added back after leaving — sees its whole history, including what was written while they were away; none of it counts as unread. |
| @mentions | Type @ for the list of members. A mention is highlighted (your own name stands out) and always rings the bell. |
| Editing | ✏️ on your message or ↑ in an empty composer; edited messages are marked. Optional time window. |
| Reactions | Six emoji, one per person per message. |
| Read receipts | ✓ sent, ✓✓ read — in a group, read by every active member (the hint lists who has not). |
| Replies | ↩ on a message quotes it above your answer; a click on the quote jumps to the original, loading earlier messages if needed. |
| Avatars | Next to the last message of a series in groups, in the @ list and the member line; direct conversations in the list always show the person. From Filament's avatar provider or ->avatarUsing(); initials when there is no picture. |
| Presence | A green dot on the avatar of whoever is online (conversation list), "Online" / "Last seen 5 minutes ago" under the name in a direct conversation, "N online" in a group. Works with real-time and with polling: a throttled heartbeat (at most one write per person per 30 s; the throttle is a cache add, so with the database cache store a poll still costs one cache query — use redis, memcached or file for none). A background browser tab is throttled by the browser, so its owner shows offline after online_seconds. The window re-renders for a heartbeat only when a dot or text actually changed, and not at all while it is closed or the tab is in the background. Online = seen within presence.online_seconds (90). Hide someone with ->hidePresenceUsing(fn ($person, $viewer) => …); off with ->presence(false). Needs the create_filament_chat_presences_table migration (table chat_presences). |
| New messages | Opening a conversation scrolls to a line where the unread part starts (up to five pages back, otherwise it opens at the bottom); sending your own message clears the line. |
| Record references | Attach a record with a picker, by dropping a link to its page, or "Attach current" in the slide-over. |
| Where | A full Chat page and a top-bar button with a slide-over; on wide screens the slide-over can be pinned as a split screen that stays open across pages. |
| Unread | Counters in the navigation, on the button, in the browser tab title and on the favicon; a bell notification on the first unread message of a conversation and on every mention; a "Reply" toast. |
| Mute | Each person can mute a conversation from its header (🔕): no bell for new messages, no toast, and it is left out of the total unread count; the conversation keeps its own (gray) count in the list. A mention still rings. |
| Multi-tenancy | With $panel->tenant(...) conversations, people, unread counters, presence, bell links and real-time channels are kept per tenant — see Multi-tenancy. |
| Privacy | A conversation is visible to its members only — admins included. Messages are never deleted. |
| RTL | Right-to-left locales (Persian…) are supported: the layout mirrors with Filament's dir="rtl", message text picks its own direction. |
| Languages | 47: English, Ukrainian, German, Spanish, French, Italian, Dutch, Polish, Brazilian Portuguese, Portuguese, Turkish, Persian and most European and ex-USSR languages (full list); add yours. |
Every feature can be switched off.
Requirements
- PHP 8.3+
- Laravel 12 or 13
- Filament 5
Installation
composer require asignua/filament-chat php artisan filament-chat:install --migrate
filament-chat:install publishes config/filament-chat.php and the migrations (5 tables), runs the
migrations with --migrate, links the agent skill with --skill and tells you what
is left. Bell notifications use Laravel's notifications table — php artisan make:notifications-table
if your app does not have it yet.
Register the plugin in your panel provider:
use Asignua\FilamentChat\FilamentChatPlugin; public function panel(Panel $panel): Panel { return $panel // ... ->databaseNotifications() ->plugin(FilamentChatPlugin::make()); }
That's it: a Chat page in the navigation and a chat button next to the user menu. The chat polls for news until you turn real-time on.
The stylesheet ships compiled and is linked after your panel's theme — no custom theme and no
@source lines are needed. It is published by php artisan filament:assets; if you commit
published assets, re-run it after upgrading the package.
Configuration
Every setting lives in config/filament-chat.php (commented — read it once) and can also be set on
the plugin, which wins. Closures — who can be written to, how people are called, per-type rules for
references — exist on the plugin only, so the config stays cacheable.
Users
FilamentChatPlugin::make() // Who can be written to and added to groups. Default: everybody in the users table. ->users(fn (Builder $query) => $query->where('is_active', true)->whereHas('roles')) // How a person is called. Default: users.name_attribute, then Filament's HasName, then `name`. ->userName(fn (User $user): string => "{$user->first_name} {$user->last_name}") // A person's avatar URL; null — initials. Default: Filament's avatar provider // (HasAvatar::getFilamentAvatarUrl(), the `avatar_url` attribute, then the panel's default provider). ->avatarUsing(fn (User $user): ?string => $user->profile_photo_url),
// config/filament-chat.php 'users' => [ 'model' => null, // null = auth.providers.users.model 'name_attribute' => null, // e.g. 'full_name' — an attribute or accessor 'search_columns' => ['name'], // e.g. ['first_name', 'last_name'] — the conversation search; their order also sorts the first 20 people a recipient select opens with 'broadcast_key' => null, // e.g. 'ulid' — names the private channel (default: the primary key) ],
UUID / ULID keys. A user model with HasUuids or HasUlids (or any string key) works as well as
an integer one: the migrations read the key type from the user model and create the user_id
columns to match. Set users.model (or auth.providers.users.model) before running them. An install
made before 1.11 keeps its integer columns; switching an existing install to UUID users means changing
those columns yourself.
Features
| Key | Plugin | Default | Off means |
|---|---|---|---|
features.groups |
->groups(false) |
true |
direct messages only; "New group" and "Manage group" disappear, the server refuses to create or change groups. Groups that already exist stay in the list and keep working (messages, leaving) |
features.reactions |
->reactions(false) |
true |
no emoji picker or chips; the server refuses reactions |
features.mentions |
->mentions(false) |
true |
no @ autocomplete, nothing highlighted or notified (mentions stored in old messages are not highlighted either) |
features.read_receipts |
->readReceipts(false) |
true |
no ✓ / ✓✓ |
features.avatars |
->avatars(false) |
true |
no pictures or initials next to messages, in the @ list or the member line |
features.replies |
->replies(false) |
true |
no ↩ button and no new quotes; quotes already stored stay visible |
features.mute |
->mute(false) |
true |
no 🔕 button; conversations muted earlier ring and count again (needs the add_muted_at… migration) |
features.editing.enabled / .window |
->editing(true, 15) |
true, null |
no editing; window — minutes after sending, null — any time |
Switching a feature off never deletes data.
Messages
'messages' => [ 'page_size' => 30, // loaded at once and per "Show earlier messages" 'max_length' => 5000, ],
Interface
| Key | Plugin | Default |
|---|---|---|
ui.dock |
->dock(false) |
true — the top-bar button and slide-over; off: the Chat page only |
ui.pinnable |
->pinnable(false) |
true — "pin" the slide-over as a split screen (from lg) |
ui.tab_badge |
->tabBadge(false) |
true — unread count in the tab title and on the favicon |
ui.color |
->color('fuchsia') |
primary — group avatars and author names |
ui.slug |
->slug('messages') |
chat |
ui.navigation.group / .sort / .icon |
->navigationGroup() / ->navigationSort() / ->navigationIcon() |
null / 90 / chat bubbles |
->navigationGroup() and ->navigationIcon() also accept enums and closures (translated group names).
Record references
A message may point at a record of your panel — an order, a customer, a page. It shows as a card with the record's icon, type and title, linking to its page.
Which records
Register resources on the plugin:
use Asignua\FilamentChat\Support\References\ReferenceType; FilamentChatPlugin::make() ->references([ ReferenceType::resource(OrderResource::class), ReferenceType::resource(CustomerResource::class)->color('warning'), ]),
From the resource the chat takes the label, icon, record title, the link (the edit page for those who may edit, the view page for the rest) and the search of the picker (the globally searchable attributes). Everything can be overridden:
ReferenceType::make('invoice', Invoice::class) ->label('Invoice') ->icon(Heroicon::OutlinedDocumentCurrencyDollar) ->color('success') ->title(fn (Invoice $invoice): string => $invoice->number) ->url(fn (Invoice $invoice): ?string => InvoiceResource::getUrl('view', ['record' => $invoice])) ->search(fn (string $search) => Invoice::where('number', 'like', "%{$search}%")->limit(20)->get()) ->searchColumns(['number', 'customer_name']) // instead of ->search() ->visibleUsing(fn (Invoice $invoice): bool => auth()->user()->can('view', $invoice)),
The key (invoice; order for ReferenceType::resource(OrderResource::class)) is stored with the
message — keep it stable.
Or every resource at once — no list to maintain:
// config/filament-chat.php 'references' => [ 'all_resources' => true, 'except' => [ActivityLogResource::class, VisitorResource::class], ], // or on the plugin ->references([ ReferenceType::allResources()->except([ActivityLogResource::class]), ReferenceType::resource(OrderResource::class)->color('warning'), // explicit types win ]),
With "all resources" the key is the resource slug (orders, activity-log/activity-logs):
renaming a slug loses the link of old messages (they show "record deleted"). Register a type
explicitly where that matters.
Records with integer, UUID and ULID keys can all be referenced: reference_id is a string column
since 1.11. On an install from before 1.11 it is still an integer until you run the
change_reference_id_to_string_on_filament_chat_messages migration; until then models keyed by a
string are left out (not offered, not attachable), and everything else works as before.
'references' => ['enabled' => false] turns references off completely.
Who sees a referenced record
A viewer who may not see the record gets its type only — no title, no link — and cannot attach it.
"May see" is references.authorize (or ->authorizeReferences() on the plugin):
| Value | Rule | A model without a policy |
|---|---|---|
'policy' (default) |
the model's view policy |
hidden |
'resource' |
the resource's canView() — Filament's own rule |
visible to everyone in the panel |
false |
no check | visible |
Watch out. Filament shows a resource whose model has no policy, but Laravel's
Gatedenies an ability nobody defined. With the default'policy', records of such a resource are visible in the panel yet can never be attached — dropping a link says so. Either add a policy (view→truefor a read-only resource) or switch to'resource'. A type's->visibleUsing()beats both.
Attaching
- Picker — the 🔗 button next to the composer: type, then search.
- Drag & drop — drop any link to a record page into an open conversation: a table row, a link in a column, a global search result, the address bar. Links of resources that are not referenceable say so ("Orders cannot be attached to messages").
- Attach current — the slide-over opened on a record page offers that record in one click.
Discuss in chat
A header action for record pages — to whom (a person or a group I am in) and the text; the record is attached:
use Asignua\FilamentChat\Actions\DiscussInChatAction; protected function getHeaderActions(): array { return [DiscussInChatAction::make()]; }
It shows only for records of a referenceable type; it works as a table row action too.
Multi-tenancy
When the panel has tenancy ($panel->tenant(Team::class)) the chat is per tenant automatically: a person who belongs to two teams sees two separate conversation lists, with separate unread counters, "N online" and people to write to.
What is scoped to the current tenant (Filament::getTenant()):
- Conversations — the list, search, opening one by its link; a conversation of another tenant does not exist from here (the policy refuses it too). A new conversation is stamped with the current tenant (
tenant_type+tenant_id, a morph pair of strings — integer, ULID and UUID keys alike). The same two people get one direct conversation per tenant. - People — "New message", group members,
@mentions and search offer the tenant's members only. By default these are the tenant'smembersrelation (tenancy.members_relation;usersis tried too); without a relation Filament'scanAccessTenant()is asked of every user — correct, but it reads the whole table, so give the relation or->tenantUsers()on a big one. - Unread counters (navigation, button, tab title) and presence (the dot, "N online") count the tenant's conversations and people only.
- Bell notifications link into the conversation's own tenant, whichever tenant is current when the notification is opened. (Filament's bell lists a person's notifications from every tenant together; the link takes them to the right one.)
- Real time — events go to
private-filament-chat.tenant.{tenant}.user.{key}instead of the per-user channel, so a person in two tenants hears only the one they are in (authorised withcanAccessTenant()); Chat Pro's typing channel carries the tenant too.
Needs one migration (vendor:publish --tag=filament-chat-migrations, migrate): the nullable tenant_type / tenant_id columns. Backward compatible: without them the chat works exactly as before (a warning is logged if tenancy is on); conversations created before have no tenant and are visible only while scoping is off — move them with an update of the two columns if you want them inside a tenant. Fails closed: on a page of a tenancy panel that has no tenant in its address (profile, tenant registration, MFA setup) the chat renders no button or slide-over, lists nobody and nothing, and refuses every write — it never falls back to "all tenants". Only code with nobody signed in (a console command, a queued job) is not narrowed.
Host code outside a tenant route — a controller, webhook or front route on the same guard, a job started synchronously inside such a request — is "signed in, no tenant" too, so the chat services (send, edit, react, leave, startDirect, createGroup…) refuse with "not a member" there and reads return nothing. Choose the tenant explicitly:
use Asignua\FilamentChat\Support\Tenancy; Tenancy::forTenant($team, fn () => app(ChatService::class)->send($conversation, $user, new MessageData('Hi'))); // acts inside $team Tenancy::unscoped(fn () => app(ConversationRepository::class)->findByUlid($ulid)); // sees every tenant, stamps none ``` A person detached from the tenant, though still a member of a conversation, gets no bell notification with its text. ```php FilamentChatPlugin::make() ->tenantScoped(false) // opt out on a panel that has tenancy
Your own tenancy (stancl/tenancy, a subdomain scheme…) — tell the plugin where the tenant is and who belongs to it:
FilamentChatPlugin::make() ->tenantScoped() // implied by the resolver ->resolveTenantUsing(fn () => tenant()) // a model, or a plain key ->tenantUsers(fn ($query, $tenant) => $query->whereBelongsTo($tenant)) // who can be written to ->authorizeTenantChannelUsing(fn ($user, string $segment) => …) // real time only, optional
tenancy.enabled in the config (null = automatic) is the same switch as ->tenantScoped(). Both closures are required with your own tenancy, otherwise the chat fails closed: without ->tenantUsers() nobody can be written to (for a tenant that is a model the plugin first tries its members / users relation when it lists your user model, then canAccessTenant()), and without ->authorizeTenantChannelUsing() the tenant's real-time channel, Chat Pro's typing channel and attachment downloads are refused — the plugin cannot verify who belongs to a tenant it does not know. The closure gets the person and the channel segment (Tenancy::channelKey([$type, $key])).
Real-time delivery
The chat works both ways — pick per environment:
FILAMENT_CHAT_REALTIME |
Behaviour |
|---|---|
false |
polling: an open conversation every 15 s, the unread counter every 60 s (polling.*) |
true |
new messages, reads, reactions and group changes arrive instantly; toasts appear on any page |
unset (null) |
on when the default broadcaster is reverb, pusher or ably |
Events carry identifiers only; the components re-read the data, so policies — not the socket
payload — decide what anyone sees. Each person listens on a private channel
filament-chat.user.{key}, authorised by the package. Events are broadcast immediately
(ShouldBroadcastNow) — no queue worker needed; if the socket is down the message is still saved
and the counters catch up by polling.
After the websocket reconnects, and when a tab comes back after being hidden longer than the poll
interval, the open conversation and the unread badge refresh once — events sent in between are not
lost.
Laravel Reverb
php artisan install:broadcasting --reverb
BROADCAST_CONNECTION=reverb FILAMENT_CHAT_REALTIME=true
php artisan reverb:start
That is all: by default (realtime.echo = 'plugin') the plugin brings Laravel Echo itself — it
reuses the Echo that Filament already ships — configured from the broadcasting connection. It also
registers /broadcasting/auth if your app has not (realtime.register_auth_route).
Where the browser connects (shared by all asign plugins). Each field (host, port, scheme) is resolved on its own, first set value wins:
FILAMENT_CHAT_WS_HOST/_PORT/_SCHEME(this plugin only);- Laravel's browser-side variables
VITE_REVERB_HOST/VITE_REVERB_PORT/VITE_REVERB_SCHEME(written byphp artisan install:broadcasting --reverb); - Filament's own Echo config,
filament.broadcasting.echo(wsHost,wsPort/wssPort,forceTLS); - the page's own host, protocol and default port.
Whichever plugin renders its hook first creates window.Echo for the whole page, so a plugin without its own address must not
fall back to localhost: set VITE_REVERB_* once and every asign plugin on the site (chat, kanban, record lock) connects to the same place.
Per-plugin override:
FILAMENT_CHAT_WS_HOST=ws.example.com # empty = the page's host FILAMENT_CHAT_WS_PORT=8080 # empty = 443 on https, 80 on http FILAMENT_CHAT_WS_SCHEME=https # empty = the page's protocol
-
Local, no Docker:
reverb:starton 8080 →FILAMENT_CHAT_WS_PORT=8080. -
Docker / Sail: PHP publishes to the service (
REVERB_HOST=reverb,REVERB_PORT=8080), the browser to the published port (FILAMENT_CHAT_WS_PORT=8080or whatever you map). -
Production behind nginx: proxy the websocket on the same host and leave the three variables empty:
location ^~ /app/ { proxy_pass http://reverb:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_read_timeout 60s; }
Pusher / Ably / another connection
Any Pusher-compatible connection works the same way (BROADCAST_CONNECTION=pusher). Pusher Channels
(cloud) is addressed by its cluster from broadcasting.connections.pusher.options.cluster.
To publish chat events on a connection other than the app's default:
FILAMENT_CHAT_BROADCAST_CONNECTION=reverb.
Your own Echo
If your app already loads window.Echo (a Vite bundle), or you configured Filament's
filament.broadcasting.echo, set FILAMENT_CHAT_ECHO=host or =filament — the plugin then only
subscribes. An existing window.Echo is never replaced.
Notifications
| Key | Default | |
|---|---|---|
notifications.database |
true |
the bell: the first unread message of a conversation (the rest only grow the counter) and every mention. Needs ->databaseNotifications(), the notifications table and Notifiable on the user model. |
notifications.toasts |
true |
a "Reply" toast for a message in another conversation (real-time only) |
A person who muted a conversation gets neither for its messages, except the bell for a mention.
Translations
The chat follows your app's locale and ships with English, Ukrainian, German, Spanish, French, Italian, Dutch, Polish, Brazilian Portuguese, Turkish, Persian and — from this release — Albanian, Armenian, Azerbaijani, Basque, Belarusian, Bosnian, Bulgarian, Catalan, Croatian, Czech, Danish, Estonian, Finnish, Georgian, Greek, Hungarian, Icelandic, Irish, Kazakh, Kyrgyz, Latvian, Lithuanian, Luxembourgish, Macedonian, Maltese, Norwegian (Bokmål), Portuguese, Romanian, Serbian (Latin and Cyrillic), Slovak, Slovenian, Swedish, Tajik, Turkmen and Uzbek. The translations were
prepared with machine assistance and have not all been reviewed by native speakers — corrections are welcome.
Every string lives in one file per language,
e.g. resources/lang/en/chat.php;
dates use the same locale (month names come from Carbon).
Another language — create lang/vendor/filament-chat/{locale}/chat.php in your app with the same
keys (copy the English file and translate it):
// lang/vendor/filament-chat/cs/chat.php return [ 'chat' => 'Chat', 'new_group' => 'Nová skupina', // ... ];
Change a few phrases — the same file with only the keys you want to change; the rest still comes from the package:
// lang/vendor/filament-chat/en/chat.php return [ 'chat' => 'Messages', ];
Copy all package translations to edit them:
php artisan vendor:publish --tag=filament-chat-translations
Translated the chat into your language? A pull request with resources/lang/{locale}/chat.php is
very welcome.
Upgrading to 1.12
Nothing is required: a host with one panel and no record conversations works as before. 1.12 adds two optional migrations, see Several panels:
add_panel_to_filament_chat_conversations(needed only for an add-on that scopes conversations by panel);add_subject_to_filament_chat_conversations(needed only for record conversations).
php artisan vendor:publish --tag=filament-chat-migrations # the migrations you already have are kept
php artisan migrate
What to check:
config('filament-chat.*')no longer reflects the plugin's setters (->users(),->color(),->slug()…): readChatConfig(orChatManager::state()) instead.- The
ChatManagerproperties ($plugin,$hooks,$references,$userNameUsing…) are deprecated; they still work as proxies to the current panel until 2.0. ->visibleUsing()closures on aReferenceTypeare now called with the person as a second argument (?Model: the given user, else the signed-in user, null for a guest). A one-parameter closure is fine; a second parameter typedModel(not nullable) fails for a guest.- Only the first chat panel keeps the plugin: a later panel registering it is ignored with a logged warning (panel registration order decides; it never was supported). An add-on such as Chat Pro lifts that.
- Code that built a link with
Chat::urlFor($conversation)can pass the recipient:Chat::urlFor($conversation, $recipient). ChatWindow::$conversationis now#[Locked]: it changes on the server only, so browser code that set it ($wire.conversation = …,$wire.$set('conversation', …)) or a test that writes it with->set('conversation', …)now fails. Open a conversation withopen($ulid)(or thefilament-chat-openevent,ChatWindow::EVENT_OPEN); a window subclass that keeps its own state in the address overridesaddressValue()/navigateTo()(see the window seams under Record access, mentions and panels). The Chat page's?c=is now bound to the window's$address.- Back / Forward on the Chat page now opens the conversation in the address (or the list) properly — before, the address changed but the window kept the old conversation.
Upgrading to 1.11
1.11 adds two migrations:
change_reference_id_to_string_on_filament_chat_messagesturnsreference_idinto a string, so records with UUID / ULID keys can be attached. Existing ids stay (42→"42";$message->reference_idstill returns an int for them). It does nothing on a column that is already a string.add_muted_at_to_filament_chat_participantsadds a nullablemuted_atto the participants (mute).
php artisan vendor:publish --tag=filament-chat-migrations # the migrations you already have are kept
php artisan migrate
Without them the chat keeps working: UUID-keyed records are not offered for references, and the
🔕 button is hidden. New installs need nothing extra: the user columns follow the user model's key
type (see Users). For extensions: filament-chat-incoming now carries muted (play no sound
for it), the policy has a mute ability (ConversationPolicy::MUTE) and ChatService::setMuted();
user and record keys are int|string throughout (compare them with Support\Keys::same()).
Upgrading to 1.7
1.7 adds presence in a fourth migration, create_filament_chat_presences_table (table tables.presences, default chat_presences; one row per person: user_id, last_seen_at):
php artisan vendor:publish --tag=filament-chat-migrations # the migrations you already have are kept
php artisan migrate
Without it the chat keeps working; there are just no dots. Add 'presence' => ['enabled' => true, 'online_seconds' => 90, 'heartbeat_seconds' => 30] and 'presences' => 'chat_presences' under tables to a published config if you want to change them (the defaults apply without). online_seconds must exceed ceil(heartbeat_seconds / polling.badge) * polling.badge plus 15 s (the heartbeat rides on the badge poll); a smaller value is logged as a warning at boot. Presence, like the other chat tables, assumes one user model (the throttle key includes its class). ->hidePresenceUsing() also receives the conversation as a third argument, and someone who left a group sees no presence in it. The "yes" of the table check is cached forever (filament-chat:presence-table:…) — clear the cache if you drop the table.
Upgrading to 1.5
1.5 adds last_read_at to the participants in a third migration, add_last_read_at_to_filament_chat_participants:
php artisan vendor:publish --tag=filament-chat-migrations # the migrations you already have are kept
php artisan migrate
Without it the chat keeps working; only the read time is not stored.
Upgrading from 1.1
1.2 adds one column (reply_to_id, replies) in a second migration, add_reply_to_filament_chat_messages.
Publish and run it:
php artisan vendor:publish --tag=filament-chat-migrations # the 1.0/1.1 migration you already have is kept
php artisan migrate
(php artisan filament-chat:install --migrate does the same: it publishes whatever is missing.)
Without the new migration 1.2 keeps working, but replies stay off until you run it: the package checks
for the reply_to_id column.
The published migration reads the table name from tables.messages, so a renamed table is covered.
Only if your messages table was not created by the package's published migration (your app made it
some other way), add the column yourself, replacing chat_messages with your table name:
Schema::table('chat_messages', function (Blueprint $table): void { $table->foreignId('reply_to_id')->nullable()->constrained('chat_messages')->nullOnDelete(); });
Avatars and the "New messages" line need no migration. Don't want avatars or replies? Switch them off
(features.avatars, features.replies) — stored quotes stay visible either way.
Several panels
Each panel keeps its own chat settings: FilamentChatPlugin::make()->users(...)->references(...)->renderHook(...),
the colour, the slug, the avatar and name closures, tenancy and the hooks belong to the panel they were set on
(read them through ChatConfig). FilamentChatPlugin::register() no longer writes into config('filament-chat.*');
the config file stays the defaults, and is what code without any registered panel reads.
The free chat is one panel. The first panel that registers the plugin (panel registration order decides) keeps it; if a later panel registers it, that one is ignored and one warning is logged
(filament-chat: the chat is already on panel "admin"; registering it on "volunteer" is ignored (one panel without Chat Pro)).
An add-on such as Chat Pro lifts the rule (it calls
app(ChatManager::class)->allowMultiplePanels()), and then every panel with the plugin has its own users, references,
hooks and tenancy. A host with one panel changes nothing and needs no migration.
Which panel a link opens. A link is Chat::urlFor($conversation, $recipient) (bell notifications, mails and so on
build it for the recipient). It opens the current panel when that is a chat panel the person (the recipient; without one,
the signed-in user) may chat in and can access (canAccessPanel()); otherwise the first panels.home panel they fit
(the panels not listed follow in registration order); if none fits, the first home panel. With an add-on that scopes
conversations by panel (scopeConversationsByPanel()), a conversation stamped with a panel always opens in that panel.
With a single chat panel every link opens in it, with no checks.
// config/filament-chat.php 'panels' => ['home' => ['admin', 'volunteer']],
Code running outside a panel (a queue job, the console) can do a piece of work as a panel with
app(ChatManager::class)->withPanel('volunteer', fn () => …); forConversation($conversation, $recipient) returns the
panel a conversation opens in.
Two optional migrations (new in 1.12). A host with one panel needs neither:
| Migration | Adds | Enables |
|---|---|---|
add_panel_to_filament_chat_conversations |
nullable panel_id |
an add-on keeping each panel's conversations to that panel (scopeConversationsByPanel()); a conversation with no panel is seen in every panel, as every row was before |
add_subject_to_filament_chat_conversations |
nullable subject_type, subject_id (the record's key as a string), subject_key (unique; a SHA-256 hex of the record, tenant and panel) |
record conversations (below) |
php artisan vendor:publish --tag=filament-chat-migrations # the migrations you already have are kept
php artisan migrate
Both are checked once per application instance and then remembered: ChatConfig::panelsAvailable() and
ChatConfig::subjectsAvailable() — a long-running process (Octane, queue:work) sees a migration run after it started
only once restarted. Without them nothing changes; without the subject columns, creating a record conversation throws.
On PostgreSQL mind that subject_id is a string column: a relation of your own from a record to its conversation
(morphOne(Conversation::class, 'subject'), whereHasMorph()) compares it with an integer or UUID key and needs a cast
there (MySQL, MariaDB and SQLite compare them as is). The package itself never queries that way.
Turning the panel scope on later (scopeConversationsByPanel(), Chat Pro's panels.scope = panel): a conversation
started before has no panel and stays one conversation for every panel — the same two people keep their direct
conversation, and a record keeps its conversation (found under the key it was started with) instead of getting a second
one per panel. Handing conversations to one panel (UPDATE chat_conversations SET panel_id = 'admin' WHERE panel_id IS NULL)
keeps them in that panel only; another panel then starts its own conversation for the same pair or record. When both a
conversation from before and a panel's own one exist, the one from before is used.
Broadcasting. The private channels (filament-chat.user.{key}, the tenant one) are authorised against every chat
panel's guard, so a person signed in on any chat panel can listen.
Deprecated. The ChatManager properties $plugin, $panelId, $references, $hooks, $modifyUsersQueryUsing,
$userNameUsing, $avatarUsing, $hidePresenceUsing, $resolveTenantUsing, $tenantUsersUsing and
$authorizeTenantChannelUsing still work in 1.12 and 1.13 as proxies to the current panel (the first chat panel when
none is current); read and write app(ChatManager::class)->state() (a PanelChat) or ->for($panelId) instead.
They are removed no earlier than 2.0.
Record conversations
A record conversation is the chat of one record (one per record, tenant and panel): everyone who may see the
record talks in it, instead of in a group someone has to keep up to date. It is created, listed and decided by
Chat Pro; the free package ships the type and the seams, and needs
the add_subject_to_filament_chat_conversations migration for it.
Without Pro the free chat treats one as a group whose title comes from the record: its participants can read and
write in it, it is listed with the record type's icon, and its title is the record's title via the
references (ReferenceType::title()), shown only to someone who may view the record
(ReferenceType::canView()); anyone else sees "No access", a deleted record "Record deleted". Nobody is added by
being able to see the record: without an add-on only participants see it.
Customising
Your own models and tables
Swap any model for a subclass and rename the tables before running the migration:
'models' => [ 'conversation' => App\Models\ChatConversation::class, // extends Asignua\FilamentChat\Models\Conversation // participant, message, reaction ], 'tables' => [ 'conversations' => 'chat_conversations', // participants, messages, reactions ],
An audit trail
Messages, reactions and read pointers are deliberately not audited — an audit feed would let admins
read other people's conversations. For conversations use a subclass with your logging trait, and
listen to Asignua\FilamentChat\Events\GroupMembersChanged ($conversation, $before, $after —
member names) for membership, which lives in a pivot the model diff cannot see.
Events
| Event | When |
|---|---|
Asignua\FilamentChat\Events\ChatUpdated |
anything changed in a conversation — broadcast to members |
Asignua\FilamentChat\Events\GroupMembersChanged |
a group was created, its members changed, someone left |
Asignua\FilamentChat\Events\MessageSent |
a message was stored by ChatService::send() ($message) — a plain event, dispatched after the commit |
Asignua\FilamentChat\Events\MessageEdited |
a message's text was changed by ChatService::edit() ($message, $editor, $previousBody) — after the commit; for audit logs |
Writing from your code
use Asignua\FilamentChat\Data\MessageData; use Asignua\FilamentChat\Services\ChatService; $chat = app(ChatService::class); $conversation = $chat->startDirect($me, $colleague); $chat->send($conversation, $me, MessageData::fromArray([ 'body' => 'Please check @Olga Green', 'reference_type' => 'order', 'reference_id' => $order->id, ])); // A reply: the ulid of a message in the same conversation (a foreign one is dropped). $chat->send($conversation, $colleague, MessageData::fromArray([ 'body' => 'Done', 'reply_to' => $message->ulid, ]));
Always go through ChatService — it stores mentions, broadcasts and notifies, and checks membership
where a message is involved (send, edit, react). Group management does not check who asks:
updateGroup() changes any group it is given and leave() acts on the user passed in. Authorize
before calling them, as the chat's own actions do:
use Asignua\FilamentChat\Policies\ConversationPolicy; abort_unless(Gate::allows('update', $conversation), 403); // the creator, still a member $chat->updateGroup($conversation, GroupData::fromArray($data)); abort_unless(Gate::allows(ConversationPolicy::LEAVE, $conversation), 403); $chat->leave($conversation, auth()->user());
Extending
Seams for add-on packages (attachments, search, typing indicators …) that change the chat window without forking it. Nothing here changes the stock chat.
Your own window
FilamentChatPlugin::make()->windowComponent(App\Livewire\MyChatWindow::class); // or ui.window_component
The class must extend Asignua\FilamentChat\Livewire\ChatWindow; it is mounted on the Chat page and
in the slide-over. If it overrides Livewire's dehydrate(), call parent::dehydrate() — that keeps the page address
(?c=) in step with the open conversation. Override these protected methods (all optional):
| Method | Default | Use |
|---|---|---|
canSendWithoutBody(): bool |
false |
true lets send() store a message with no text and no record (the content is carried some other way) |
beforeMessageCommit(Message $message) |
no-op | runs inside the send transaction — store your own rows; a throw rolls the message back |
afterMessageSent(Message $message) |
no-op | after a successful send from this window — reset your own composer state |
modifyMessagesQuery(Builder $query): Builder |
$query |
shapes every feed query (page, "load older", unread line, jumps, read pointer): eager-load, or withTrashed() for a message model with soft deletes |
conversationChanged(?string $from, ?string $to) |
no-op | another conversation was opened (list, toast, search hit) or the person went back to the list ($to null): drop state that belongs to the old one — pending uploads, a draft. Ulids |
isMessageTombstone(Message $message): bool |
false |
true renders «Message deleted» instead of text, record, reactions, reply/edit/menu — also in a quote of it and in the conversation list preview |
openMessage(string $messageUlid) (public) jumps to a message of any of the person's
conversations: it opens the conversation first if needed, loads up to the message and flashes it. A
message of a conversation the person may not see, or written after they left a group, is ignored.
The message model comes from models.message; a subclass with SoftDeletes works (the free chat adds
none). A soft-deleted message is not counted as unread. The MessageRepository reads take an optional
trailing ?Closure $scope — that is how modifyMessagesQuery() reaches them.
Record access, mentions and panels
For add-ons (an add-on such as Chat Pro registers these); all installation-wide, none changes the stock chat.
$chat = app(ChatManager::class); // Who may do what in a record conversation. Without a resolver: participants only, as in a group. $chat->recordAccessUsing(function (Conversation $conversation, Model $person, string $ability): bool { // $ability: RecordAccess::VIEW (open and read), SEND (write; the author joins on writing), // LIST (its entry in the list, the unread counters, socket events), // NOTIFY (the bell, the toast and its sound) }); // Whom "@" offers in a record conversation beyond its members (only those who may view and write); // one who is mentioned joins. Without a resolver: the members. $chat->mentionablesUsing(fn (Conversation $conversation, Model $author, string $term, int $limit): iterable => …); // Ring people beyond the members about a message in a record conversation (only those it lets be notified, never the // author or a member; every message they are returned for, without joining). Without a resolver: the members only. $chat->alsoNotifyUsing(fn (Conversation $conversation, Message $message, Collection $members): iterable => …); // Hide some readers' read status from some people: true keeps $viewer from seeing that $reader read their messages // (no ✓✓, no name in the hint, no socket event); a hidden reader is not counted. Without a rule everyone's shows. $chat->hideReadReceiptsUsing(fn (Model $reader, Model $viewer, Conversation $conversation): bool => …); $chat->scopeConversationsByPanel(); // each panel sees the conversations stamped with it (needs the panel migration) $chat->allowMultiplePanels(); // lift the one-panel rule; call it before the panels are built
The resolver is asked for any person, a recipient too, so it must not assume the current panel or the signed-in user;
answers are not kept beyond the request (which of a person's record conversations they may not list or read is
remembered for the request, and asked anew after a join or a leave). A conversation the person may not list is left out of the list and the counters, and a
person who may not be notified gets no bell and no socket event. RecordAccess::allows($conversation, $user, $ability)
is the check the chat itself uses.
ReferenceType::canView($record, ?$user = null)answers for someone other than the signed-in person (null — the signed-in one); record titles in a bell are checked against the recipient. Upgrade note: avisibleUsing()closure now receives$personas a second argument,?Model: the given user, else the signed-in user, null for a guest, so type it?Model(a one-argument closure keeps working).ChatUsers::actingAs($user, fn () => …)runs the callback with$usersigned in on the guard Filament reads (Filament::auth()), so a resource'scanView()answers for that person in a queue or console; the previous person is put back, also on a throw. Nothing touches the session. When$useris already that guard's user the callback just runs. A real swap fires Laravel'sAuthenticatedevent on a session guard, on the swap and, when there was a previous user, on the restore (a guest is restored withforgetUser(), no event); token and request guards fire nothing. In practice your ownAuthenticatedlisteners (last-login stamps and the like) run while titles are checked for another person.ChatManager::withPanel($panelId, fn)andforConversation($conversation, ?$recipient): see Several panels.Chat::urlFor($conversation, ?$recipient)builds the link.ConversationRepository::draftForSubject()/createForSubject()give a record's draft and its stored conversation.
More seams on the window (Your own window):
| Method | Default | Use |
|---|---|---|
draftConversation(): ?Conversation |
null |
the conversation shown while none is open, typically a record's, not stored yet; shown only if the person may view it |
persistDraft(Conversation $draft, Model $author): Conversation |
throws | stores the draft when its first message is sent (inside the message's transaction) and returns the stored one |
addressValue(): ?string |
the open conversation's ulid | what the Chat page's address (?c=) shows for the window's state |
navigateTo(?string $value): void |
null → back to the list; a ulid the person may view → open it; else nothing |
Back / Forward in the browser changed the address |
mentionsRemote(Conversation $conversation): bool |
a record conversation decided by a resolver, with a mentionables resolver | look "@" up as one types (searchMentions()) instead of sending the people with the page |
mentionCandidates(Conversation $conversation, Model $me, string $term): array |
the members, or the mentionables | whom "@" offers |
Render hooks
use Asignua\FilamentChat\Enums\ChatHook; FilamentChatPlugin::make() ->renderHook(ChatHook::COMPOSER_TOOLS, fn (ChatWindow $window, array $context) => view('my.attach-button')) ->renderHook(ChatHook::MESSAGE_MENU, fn (ChatWindow $window, array $context) => view('my.message-menu', ['message' => $context['message']]));
{{-- resources/views/my/message-menu.blade.php — values go into JS through @js(), never through e() --}} <button type="button" wire:click="deleteMessage(@js($message->ulid))">…</button>
The closure returns Htmlable, a View, an HTML string or
null. The markup is rendered inside the Livewire component, so wire:click reaches the methods
of your window subclass and $wire is available to Alpine. $context['conversation'] is the open
conversation (null in SIDEBAR_BEFORE without one); the message hooks add message and mine.
Give the root element of your markup a wire:key.
Warning — trusted HTML. A string (or
Htmlable) is printed as it is. Put user data only into a Blade view ({{ }}escapes), and pass values intowire:click/ Alpine expressions with@js(...)orJs::from(...):e()escapes HTML but not a quote inside a JavaScript string.
ChatHook |
Place |
|---|---|
SIDEBAR_BEFORE |
top of the conversation list, above the search box |
HEADER_ACTIONS |
conversation header, before the group buttons |
FEED_BEFORE |
top of the feed |
MESSAGE_BODY_AFTER |
in the bubble, after the text and the record card |
MESSAGE_MENU |
the buttons beside a bubble |
COMPOSER_BEFORE / COMPOSER_AFTER |
first / last in the composer form |
COMPOSER_TOOLS |
in the input row, right before the send button |
Hooks can also be added from an add-on's service provider: app(ChatManager::class)->hooks->register($hook, $closure).
Browser events
The composer dispatches filament-chat-typing on every input and filament-chat-paste
(detail.event — the ClipboardEvent, for pasted images) — listen with x-on:filament-chat-typing.window
in a hook's markup. Other events are the constants on ChatWindow (EVENT_SCROLL, EVENT_HIGHLIGHT …).
filament-chat-incoming (ChatDock::EVENT_INCOMING) announces a new message from someone else:
{conversation, message, open, muted} — open when it is on the screen, muted when the person
muted that conversation (an add-on that plays a sound should stay silent then).
Channels and scripts
The chat only authorizes its own per-person channel. An extension that needs more (a per-conversation
typing channel) registers it with plain Laravel — Broadcast::channel('my-ext.conversation.{ulid}', …)
— and listens in the browser through the Echo the chat already set up: window.Echo.private(…)
(window.Echo exists once the EchoLoaded event fired or when realtime.echo is plugin).
Whispers (client events) need them enabled on the socket server. Put the script in a hook's markup
(@script / Alpine x-init) or in a panel render hook of your own.
Integration notes
-
Custom themes. The stylesheet is linked after the panel's theme on purpose: a theme compiles the same Tailwind utilities (
.bg-white) and, loaded later, would beat the chat'sdark:variants. The other direction is closed too: every utility in the chat's CSS is emitted under.fchat-scope(the window, the slide-over and the Chat page carry it), so the chat cannot override the host'shidden lg:blockordark:bg-gray-900elsewhere. A published view that mounts the window outside those places needs afchat-scopeancestor. -
A panel built by a package (a CMS that owns its
PanelProvider): add the plugin when the panel registers —boot()is too late, the panel's routes already exist:// AppServiceProvider::register() $this->app->resolving(PanelRegistry::class, function (PanelRegistry $registry): void { $registry->get('cms', isStrict: false)?->plugin(FilamentChatPlugin::make()); });
-
Several panels. The free chat lives on one panel; see Several panels.
-
Users of another panel (customers in a client cabinet): narrow
->users()to the people of the chat's panel. -
Search uses
LIKE: case-insensitive on MySQL/MariaDB and PostgreSQL; on SQLite for ASCII only.
Troubleshooting
| Symptom | Cause / fix |
|---|---|
| "… cannot be attached to messages" on a drop | the resource is not referenceable — register it or use all_resources |
| "This link does not lead to a record…" | not a record page of this panel (a list, another host) |
| A record shows its type but "no access" | references.authorize = 'policy' and the model has no policy — see Who sees |
| The slide-over is white on a dark panel | stale published assets — php artisan filament:assets |
| "Laravel Echo cannot be found" in the console | real-time is on but no Echo: realtime.echo is host/filament without one, or window.EchoFactory is missing (Filament's core scripts) |
| Messages arrive only after ~15 s | real-time is off (FILAMENT_CHAT_REALTIME), or the socket is not reachable from the browser — check FILAMENT_CHAT_WS_* and the browser's network tab |
403 on /broadcasting/auth |
the user is not logged in on the web guard, or broadcast_key differs between server and channel |
| No bell notifications | ->databaseNotifications() on the panel, the notifications table, Notifiable on the user |
AI agents
The package ships a skill for coding agents (Claude Code and others reading .claude/skills) —
installation, every option, record references, real-time setups and the traps above:
php artisan filament-chat:install --skill # links .claude/skills/filament-chat
It lives in resources/boost/skills/filament-chat/SKILL.md, where Laravel Boost looks for package skills.
Testing
composer test # PHPUnit (Orchestra Testbench) composer analyse # Larastan composer format # Pint npm run build # rebuild resources/dist/filament-chat.css after changing views
Changelog
See CHANGELOG.md.
More plugins by asign
- Chat Pro — files, typing indicator and search for Chat
- Mail Log — journal of outgoing mail
- Record Lock — stop two people editing the same record
- Themes — per-user and per-panel colour themes
All plugins: https://filamentphp.com/plugins?q=asign
Catalogue of free and commercial plugins: https://asign.tech/en/plugins
License
MIT. See LICENSE.md.




