!!! Guys, I archived this project because I'm not using it anymore. If you want it, I can transfer my rights to you !!!
Replace default Boolean with switcher.
Work on Index/Detail view with xhr, on Form like checkbox.
composer require trin4ik/nova-switcher
use Trin4ik\NovaSwitcher\NovaSwitcher;
...
NovaSwitcher::make('Active');
use Trin4ik\NovaSwitcher\NovaSwitcher;
...
NovaSwitcher::make('Active')
->trueLabel('On')
->falseLabel('Off');
...
NovaSwitcher::make('Active')
->withLabels(true: 'On', false: 'Off');
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?');
Also, you can use reverse value (if switcher checked, value is false and vice versa)
NovaSwitcher::make('Active')
->reverse();
- David Piesse, based on https://github.com/davidpiesse/nova-toggle
- Thomas Lombart for the switcher css