PHP code example of rupadana / filament-panel-switch

1. Go to this page and download the library: Download rupadana/filament-panel-switch 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/ */

    

rupadana / filament-panel-switch example snippets


public function boot()
{
    PanelSwitch::configureUsing(function (PanelSwitch $panelSwitch) {
        //
    });
}

PanelSwitch::configureUsing(function (PanelSwitch $panelSwitch) {
    $panelSwitch
        ->visible(fn (): bool => auth()->user()?->hasAnyRole([
            'admin',
            'general_manager'
            'super_admin',
        ]));
});

PanelSwitch::configureUsing(function (PanelSwitch $panelSwitch) {
    $panelSwitch
        ->canSwitchPanels(fn (): bool => auth()->user()?->can('switch_panels'));
});

PanelSwitch::configureUsing(function (PanelSwitch $panelSwitch) {
    $panelSwitch->excludes([
        'saas'
    ]);
});

PanelSwitch::configureUsing(function (PanelSwitch $panelSwitch) {
    $panelSwitch->renderHook('panels::global-search.before');
});

PanelSwitch::configureUsing(function (PanelSwitch $panelSwitch) {
    $panelSwitch
        ->visible(fn (): bool => auth()->user()?->hasAnyRole([
            'admin',
            'general_manager'
            'super_admin',
        ]))
        ->canSwitchPanels(fn (): bool => auth()->user()?->can('switch_panels'))
        ->excludes([
            'saas'
        ])
        ->renderHook('panels::global-search.before');
});

export default {
    content: [
        // ...
        './vendor/bezhansalleh/filament-panel-switch/resources/views/panel-switch-menu.blade.php',
    ],
    // ...
}

"    "bezhansalleh/filament-panel-switch": "dev-fix/error-message as main-dev",
},
"repositories": [
    {
        "type": "path",
        "url": "filament-panel-swtich"
    }
]
bash
php artisan vendor:publish --tag="filament-panel-switch-views"