wamesk/laravel-nova-menu-switcher

There is no license information available for the latest version (1.0.1) of this package.

1.0.1 2024-10-25 10:22 UTC

This package is auto-updated.

Last update: 2024-12-25 10:42:15 UTC


README

Description

Creates input select that refreshes page and sets value to session.

img.png

img_1.png

Installation

composer require wamesk/laravel-nova-menu-switcher

Usage

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

If you want to control who can use switcher you can add can_use_switcher attribute in user

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