Laravel Nova icon Nova Packages
S

Switcher Field

This package is possibly abandoned. Please proceed with care.

Readme

!!! Guys, I archived this project because I'm not using it anymore. If you want it, I can transfer my rights to you !!!

Laravel Nova Switcher Field

Replace default Boolean with switcher.
Work on Index/Detail view with xhr, on Form like checkbox.

Installation

composer require trin4ik/nova-switcher

Usage

use Trin4ik\NovaSwitcher\NovaSwitcher;
...
NovaSwitcher::make('Active');

Labels

use Trin4ik\NovaSwitcher\NovaSwitcher;
...
NovaSwitcher::make('Active')
    ->trueLabel('On')
    ->falseLabel('Off');
...
NovaSwitcher::make('Active')
    ->withLabels(true: 'On', false: 'Off');

Confirmation

use Trin4ik\NovaSwitcher\NovaSwitcher;
...
NovaSwitcher::make('Active')
    ->confirmToTrue('enable?')
    ->confirmToFalse('disable?');
...
NovaSwitcher::make('Active')
    ->confirm(toTrue: 'enable?', toFalse: 'disable?');

of couse, you can only use confirmation dialogue to enable, or disable:

use Trin4ik\NovaSwitcher\NovaSwitcher;
...
NovaSwitcher::make('Active')
    ->confirmToFalse('Turn it off?');

Reverse

Also, you can use reverse value (if switcher checked, value is false and vice versa)

NovaSwitcher::make('Active')
    ->reverse();

Thanks to...

Reviews

Rated 1 stars out of 5

By denisvasilievclarity on February 28, 2024

Work on Index page, but doesn't work on Detail page.

Back to Top
Added 2 years ago
Last updated 2 Years Ago
Version v0.4
Nova Version ^4.0
Composer
trin4ik/nova-switcher
GitHub stars 12
Packagist downloads 53,012

Favorites

4 users favorited

Rating

4.00
(out of 5)
★★★★★
★★★★
★★★
★★
4 ratings

Author

Contributors

Tags

Brought to you by Tighten

Issues/Feature Requests Stats Package Ideas