Overview
Panels are the central configuration object in WireChat. They act as a container for all chat-related settings, behaviors, and customizations. Think of a Panel as the “control center” for your chat application.What is a Panel?
A Panel is the main entry point for configuring WireChat. It uses a fluent interface pattern that allows you to chain configuration methods together. Each Panel can be customized with colors, layouts, authentication, broadcasting, middleware, and more.Panel Architecture
The Panel class is built using multiple trait-based concerns, making it highly modular and extensible:Creating a Panel
Panels are created using the staticmake() method, which leverages Laravel’s service container:
The
make() method uses app(static::class) internally, allowing for dependency injection and singleton behavior.Default Panel
You can mark a panel as the default panel for your application:default() method accepts a boolean or Closure:
Panel Configuration Traits
Each trait provides specific configuration capabilities:HasAuth
HasAuth
Configure authentication and user management for your chat.
HasBroadcasting
HasBroadcasting
Set up real-time broadcasting for live chat updates.
HasColors
HasColors
Customize the color scheme of your chat interface.
HasLayout
HasLayout
Configure the visual layout and structure of the chat UI.
HasGroups
HasGroups
Enable and configure group chat functionality.
HasAttachments
HasAttachments
Configure file upload and attachment handling.
HasMiddleware
HasMiddleware
Add middleware to protect chat routes and actions.
HasWebPushNotifications
HasWebPushNotifications
Enable push notifications for chat messages.
Registration
After configuring your panel, register it to apply all settings:The
register() method is called to finalize the panel configuration and make it active in your application.Closure Evaluation
Panels support closure-based configuration through theEvaluatesClosures trait. This allows you to defer configuration logic until runtime:
evaluate() method is used internally to resolve closures:
Best Practices
Next Steps
Conversations
Learn about conversation types and management
Messages
Understand message handling and types