jeffersonsimaogoncalves / nova-advanced-number-field
A Laravel Nova field which adds additional functionality to the default Number field.
Requires
- php: ^7.3|^8.0
- laravel/nova: ^4.0
Requires (Dev)
- orchestra/testbench: ^5.0
- phpunit/phpunit: ^8.0
- symfony/var-dumper: ^4.3
This package is auto-updated.
Last update: 2025-02-09 07:10:22 UTC
README
A Laravel Nova field which adds additional functionality to the default Number field by using PHP's number_format()
function.
Installation
You can install this package in a Laravel app that uses Nova via composer:
composer require jeffersonsimaogoncalves/nova-advanced-number-field
Usage
The AdvancedNumber
field provides an additional 5 methods to the default Number
field, namely:
->prefix('$')
: Sets the prefix to be used when displaying the number.->thousandsSeparator(' ')
: Set the thousands separator symbol to be used when displaying the number.->decimalPoint('.')
: Sets the decimal point symbol to be used when displaying the number.->decimals(3)
: Sets the number of decimal points to be used as well as the step value.->suffix('%')
: Sets the suffix to be used when displaying the number.
You can use the field in your Nova resource like so:
namespace App\Nova; use SimpleSquid\Nova\Fields\AdvancedNumber\AdvancedNumber; class User extends Resource { // ... public function fields(Request $request) { return [ // ... AdvancedNumber::make('Price') ->prefix('$') ->thousandsSeparator(','), // AdvancedNumber extends Number, so you can use Number methods too: AdvancedNumber::make('Markup') ->decimals(0) ->suffix('%') ->min(0)->max(100), // ... ]; } }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email security@simplesquid.co.za instead of using the issue tracker.
Credits
Package skeleton based on spatie/skeleton-php.
About us
SimpleSquid is a small web development and design company based in Cape Town, South Africa.
License
The MIT License (MIT). Please see License File for more information.