Giter Site home page Giter Site logo

workupsrl / nova-money-field Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vyuldashev/nova-money-field

0.0 1.0 0.0 1.21 MB

Money Field for Laravel Nova

Home Page: https://novapackages.com/packages/vyuldashev/nova-money-field

JavaScript 23.75% PHP 35.00% Vue 41.05% SCSS 0.20%

nova-money-field's Introduction

Money Field for Laravel Nova

Latest Version on Packagist Total Downloads

screenshot 1

Installation

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

composer require workup/nova-money-field

Usage

In resource:

// ...
use Workup\Nova\MoneyField\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'),

nova-money-field's People

Contributors

vyuldashev avatar stefblokdijk avatar rslanzi avatar zek avatar binarykitten avatar japseyz avatar glennjacobs avatar mathieutu avatar dependabot-support avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.