Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Nova Money Field

vyuldashev/nova-money-field image

Nova Money Field stats

Downloads
537.4K
Stars
73
Open Issues
16
Forks
31

View on GitHub →

A Laravel Nova field for Money.

Money Field for Laravel Nova

Installation

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

composer require vyuldashev/nova-money-field

Usage

In resource:

// ...
use Vyuldashev\NovaMoneyField\Money;
 
public function fields(Request $request)
{
return [
// ...
Money::make('Balance'),
];
}

USD currency is used by default, you can change this by passing second argument:

Money::make('Balance', 'EUR'),

You may use locale method to define locale for formatting value, by default value will be formatted using browser locale:

Money::make('Balance')->locale('ru-RU'),

If you store money values in database in minor units use storedInMinorUnits method. Field will automatically convert minor units to base value for displaying and to minor units for storing:

Money::make('Balance', 'EUR')->storedInMinorUnits(),

If you need to use a name that doesn't convert to the column name (eg 'Balance' as name and remaining_balance as column) you can pass this as the 3rd argument to the make/constructor.

Please Note: that this, along with all field column names, should be present and usable within your model class else you may encounter SQL errors.

Money::make('Balance', 'EUR', 'remaining_balance'),
vyuldashev photo

Passionate Developer.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Vyuldashev Nova Money Field Related Articles

Livewire Admin Panel: Lean Admin image

Livewire Admin Panel: Lean Admin

Read article
Statamic logo

Statamic

The drop-in ready Laravel CMS you’re been waiting for. Go full-stack or headless, flat file or database – it’s up to you.

Statamic
Tighten logo

Tighten

We help companies turn great ideas into amazing apps, products, and services.

Tighten
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Honeybadger logo

Honeybadger

Simple developer-focused application monitoring for Laravel. Error tracking, log management, uptime monitoring, status pages, and more!

Honeybadger
DreamzTech logo

DreamzTech

Hire 6-10+ Yrs. experienced skilled Laravel Developers from DreamzTech. We ensure NDA protected, 100% quality delivery. Contact Us & Discuss Your Need.

DreamzTech
Securing Laravel logo

Securing Laravel

The essential security resource for Laravel devs, covering everything you need to keep your apps secure. Sign up to receive weekly security tips and monthly in depth articles, diving deep into security concepts you need to know!

Securing Laravel