elsayed85 / nova-switcher
A Laravel Nova switcher field.
dev-main
2023-01-14 16:36 UTC
Requires
- php: ^7.3|^8.0
This package is not auto-updated.
Last update: 2024-12-15 23:37:11 UTC
README
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') ->trueLabel('On') ->falseLabel('Off');
or
NovaSwitcher::make('Active') ->withLabels(true: 'On', false: 'Off');
Also, you can use reverse value (if switcher checked, value is false and vice versa)
NovaSwitcher::make('Active') ->reverse();
Thanks
to David Piesse, based on https://github.com/davidpiesse/nova-toggle