Replace default Boolean with switcher

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')
    ->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

GitHub

View Github