PHP code example of henryonsoftware / filament-panel-switcher

1. Go to this page and download the library: Download henryonsoftware/filament-panel-switcher library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

henryonsoftware / filament-panel-switcher example snippets


use HenryOnSoftware\FilamentPanelSwitcher\FilamentPanelSwitcherPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(FilamentPanelSwitcherPlugin::make());
}

return [
    'panels' => [
        'admin' => [
            'label' => 'Admin',
            'icon'  => 'heroicon-o-cog-8-tooth',
        ],
        'app' => [
            'label' => 'App',
            'icon'  => 'heroicon-o-home',
        ],
    ],
];

FilamentPanelSwitcherPlugin::make()->configKey('my-config.panels')

use Filament\Panel;

public function canAccessPanel(Panel $panel): bool
{
    return match ($panel->getId()) {
        'admin'  => $this->isAdmin(),
        default  => true,
    };
}
bash
php artisan vendor:publish --tag=filament-panel-switcher-config
bash
php artisan vendor:publish --tag=filament-panel-switcher-css
bash
php artisan vendor:publish --tag=filament-panel-switcher-views