PHP code example of wamesk / laravel-nova-menu-switcher

1. Go to this page and download the library: Download wamesk/laravel-nova-menu-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/ */

    

wamesk / laravel-nova-menu-switcher example snippets


// NovaServiceProvider.php
Nova::mainMenu(function (Request $request) {
    return [
        ...
        Switcher::make([
            'value1' => 'option1',
            'value2' => 'option2',
            'value3' => 'option3',
        ], 'option', 'value2'),
        ...
    ];
});

// User.php
public function getCanUseSwitcherAttribute(): bool
{
    return $this->is_super_admin;
}