PHP code example of davidpiesse / nova-toggle

1. Go to this page and download the library: Download davidpiesse/nova-toggle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

davidpiesse / nova-toggle example snippets


use Davidpiesse\NovaToggle\Toggle;

Toggle::make('Active')
    ->trueValue('On')
    ->falseValue('Off')

Toggle::make('Active')
    ->showLabels() //Both labels
    ->showOnlyTrueLabel() //True label only
    ->showOnlyFalseLabel() //False label only

Toggle::make('Active')
    ->showLabels()
    ->trueLabel('Tru Dat')
    ->falseLabel('Nah Dawg')

Toggle::make('Active')
    ->width(80)
    ->height(45) //To override scaling

Toggle::make('Active')
    ->trueColor('pink')
    ->falseColor('#fcfcfc')

Toggle::make('Active')
    ->speed(500)

Toggle::make('Active')
    ->editableIndex()