Laravel Community Tools by Tighten
Laravel Nova icon Nova Packages
N

Percent Field

Readme

Percent field for Laravel Nova

Laravel Nova field for displaying percents

Usually percents are stored in the database in a decimal form (e.g. 0.1615 which equals to 16.15%). In order to simplify formatting one can use this package.

1. Index view

screenshot 1

2. Detailed view

screenshot 1

3. Form view

screenshot 1

Installation

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

composer require nsavinov/nova-percent-field

Usage

Inside the resource:

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
    ];
}
Back to Top
Added 7 years ago
Last updated 7 Years Ago
Version v1.0.1
Composer
nsavinov/nova-percent-field
GitHub stars 21
Packagist downloads 274,647

Favorites

10 users favorited

Rating

5.00
(out of 5)
★★★★★
★★★★
★★★
★★
2 ratings

Author

Brought to you by Tighten

Issues/Feature Requests Stats Package Ideas