pimoudeveldhuis/toggle-switch-field

A Toggle Switch Field for Nova 4.

1.2.0 2024-06-20 13:41 UTC

This package is auto-updated.

Last update: 2024-12-20 15:08:12 UTC


README

Toggle Switch Field for Nova 4

Features:

  • Set custom color using hex color code
  • Toggle or Icon align. Default (left)
  • Toggle Switch in Index to update value instead of icons. Default (true)
  • Toggle Switch in Detail to update value instead of icons. Default (true)

Requirements

  • PHP 8.0 or higher
  • Nova 4

Installation

You can install the package into a Laravel app that uses Nova via composer:

composer require pimoudeveldhuis/toggle-switch-field

Usage

Table column migration

$table->boolean('toggle')->nullable()->default(true);

Add the field to Nova Resource

  public function fields(NovaRequest $request)
    {
        return [
           ToggleSwitchField::make('Toggle','toggle')
                ->color('#3AB95A')
                ->toggleAlign('center')
                ->indexToggle(false)
                ->detailToggle(false),
                ->formToggle(true),
        ];
    }

Screenshots

Custom hex color code


Detail Page Toggle Switch On



Detail Page Toggle Switch Off



Detail Page Icons On



Detail Page Icons Off



Edit Page Toggle Switch On




Edit Page Toggle Switch Off




Index Page Toggle Switch



Index Page icons



Support:

naif@naif.io

https://naif.io

Bug Tracker:

https://github.com/naifalshaye/toggle-switch-field/issues

License

The MIT License (MIT). Please see License File for more information.