trin4ik/nova-switcher

A Laravel Nova switcher field.

Downloads

187

Stars

1

Version

v0.2

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

trin4ik

Author

trin4ik