DEV Community

Cover image for Toggle Switch Field for Nova 4
Naif Alshaye
Naif Alshaye

Posted on

Toggle Switch Field for Nova 4

Toggle Switch Field for Nova 4

* Toggle Switch Field for Nova 3 go to

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

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 naif/toggle-switch-field
Enter fullscreen mode Exit fullscreen mode

Usage

Table column migration

$table->boolean('toggle')->nullable()->default(true);
Enter fullscreen mode Exit fullscreen mode

Add the field to Nova Resource

  public function tools()
    {
    # You can set the toggle switch color by color code.
        return [
            new ToggleSwitchField::make('toggle')->color('#3AB95A'),
        ];
    }
Enter fullscreen mode Exit fullscreen mode

Screenshots

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Support:

naif@naif.io

https://naif.io

Bug Tracker:

https://github.com/naifalshaye/chatgpt-nova4/issues

License

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

Top comments (0)