Skip to main content

Overview

The make:wirechat-panel command creates a new panel provider class that allows you to configure isolated chat instances with different settings, routes, and permissions.

Command Signature

php artisan make:wirechat-panel {id?}

Arguments

id
string
The panel identifier (e.g., admin, support, team). If not provided, you’ll be prompted to enter it.Requirements:
  • Must start with a letter
  • Can contain only letters, numbers, and underscores
  • Maximum 255 characters
  • Will be automatically converted to kebab-case

What It Does

1

Validate Panel ID

Validates the panel ID format and ensures it meets naming requirements.
2

Generate Provider Class

Creates a panel provider class in app/Providers/Wirechat/ with the name {PanelId}PanelProvider.php.
3

Register Provider

Automatically registers the provider in bootstrap/providers.php (Laravel 11+) or config/app.php (Laravel 10 and below).
4

Set Default Panel

If this is the first panel, it will be marked as the default panel automatically.

Interactive Prompts

Panel ID Input

If you don’t provide the panel ID as an argument:
 What is the panel ID?: admin

Overwrite Existing File

If a panel provider with the same name already exists:
The file [app/Providers/Wirechat/AdminPanelProvider.php] already exists. Do you want to overwrite it? (yes/no) [no]

Examples

Create Admin Chat Panel

php artisan make:wirechat-panel admin
Output:
Wirechat panel [App\Providers\Wirechat\AdminPanelProvider] created successfully.
We've tried to add [app/Providers/Wirechat/AdminPanelProvider.php] into your [bootstrap/providers.php] file.

Create Support Chat Panel

php artisan make:wirechat-panel support
This creates app/Providers/Wirechat/SupportPanelProvider.php:
<?php

namespace App\Providers\Wirechat;

use Wirechat\Wirechat\Panel;
use Wirechat\Wirechat\PanelProvider;
use Wirechat\Wirechat\Support\Color;

class SupportPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->id('support')
            ->path('support')
            ->colors([
                'primary' => Color::Blue,
            ]);
    }
}

Interactive Panel Creation

php artisan make:wirechat-panel
You’ll be prompted:
 What is the panel ID?: team-chats

Wirechat panel [App\Providers\Wirechat\TeamChatsPanelProvider] created successfully.

Panel ID Validation

The command validates panel IDs with the following rules:
admin
support
teamChat
customer_service
help_desk

Error Messages

Invalid Panel ID Format

The ID must start with a letter and contain only letters, numbers, or underscores.

Missing Stub File

Stub file not found at: /path/to/stubs/PanelProvider.stub

Provider Registration Failed

Failed to register provider: [error message]
If the provider file was created but registration failed, the command will automatically delete the generated file to maintain a clean state.

Post-Creation Steps

After creating a panel:
  1. Customize the panel provider:
    return $panel
        ->id('admin')
        ->path('admin/chats')
        ->middleware(['web', 'auth', 'admin'])
        ->colors([
            'primary' => Color::Red,
        ])
        ->maxGroupMembers(50);
    
  2. Access your panel at /admin/chats (or your configured path)
  3. Configure panel-specific settings like middleware, guards, and colors

Laravel Version Compatibility

Laravel 11+
version
Providers are registered in bootstrap/providers.php
Laravel 10 and below
version
Providers are registered in config/app.php in the providers array
The command will warn you if automatic registration may have failed. Always verify that your panel provider is properly registered in the appropriate file for your Laravel version.

Source Reference

Command implementation: ~/workspace/source/src/Console/Commands/MakePanelCommand.php:17