Real-time — Laravel Reverb
WebSocket-based real-time notifications using Laravel Reverb. Replaces polling with push events for matter assignments, invoice payments, and appointment reminders.
What Uses Real-time
| Event | Triggered by | Notified users |
|---|---|---|
| Matter assigned | MatterAttorney created | Assigned lawyer |
| Invoice paid | Payment created | Billing admin + matter lead |
| Appointment reminder | Scheduled job (1hr before) | All attendees |
| Document uploaded | ProcessDocumentJob complete | Matter team |
| Comment added | Comment created | Matter team |
Setup
composer require laravel/reverb
php artisan reverb:install
php artisan reverb:start
Reverb runs as a separate long-running process but uses the same Laravel application code.
Broadcasting a Notification
// app/Notifications/MatterAssignedNotification.php
class MatterAssignedNotification extends Notification implements ShouldBroadcast
{
public function broadcastOn(): array
{
return [new PrivateChannel("user.{$this->userId}")];
}
public function broadcastAs(): string
{
return 'matter.assigned';
}
}
Filament Integration
Filament's DatabaseNotification component polls for unread notifications by default.
With Reverb, this is replaced by a WebSocket listener that pushes the unread count to
the panel in real time — no polling overhead.
Authentication
Private channels require authentication. The channel auth endpoint is provided by Laravel's broadcasting system:
// routes/channels.php
Broadcast::channel('user.{userId}', function (User $user, int $userId) {
return $user->id === $userId;
});