elsayed85/nova-switcher

A Laravel Nova switcher field.

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 7

Language:Vue

dev-main 2023-01-14 16:36 UTC

This package is not auto-updated.

Last update: 2024-11-17 23:16:03 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