PHP code example of nsavinov / nova-percent-field

1. Go to this page and download the library: Download nsavinov/nova-percent-field 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/ */

    

nsavinov / nova-percent-field example snippets


use Nsavinov\NovaPercentField\Percent;

public function fields(Request $request)
{
    return [
        // ...
                    Percent::make('Rate')
                    
                        // possible options
                        
                        ->storedInDecimal(true) // true by default (converts 0.15 to 15.00)
                        ->precision(2) // digits after dot
                        
                        ->storedInDecimal(false) // for displaying raw value from database
                        
                        ->displayPercentSign(true) // true by default
    ];
}