Search by

optimistdigital / nova-currency-vat-field

Tarpsvo

A Laravel Nova Currency field extension with VAT toggle.

Package info

github.com/outl1ne/nova-currency-vat-field

Language:Vue

pkg:composer/optimistdigital/nova-currency-vat-field

Statistics

Installs: 3 225

Dependents: 0

Suggesters: 0

Stars: 3

Open Issues: 0

3.1.0 2026-10-09 10:29 UTC

This package is auto-updated.

Last update: 2026-10-09 10:30:48 UTC


README

Latest Version on Packagist Total Downloads

This Laravel Nova package allows you to create and manage menus and menu items.

Requirements

  • php: >=8.1
  • laravel/nova: ^5.0

Features

An extension of Nova's default Currency field that provides a checkbox for toggling between VAT and non-VAT prices on the Form view.

Renders the default Currency field on Index and Detail views.

Screenshots

Form page

Installation

Install the package in to a Laravel app that uses Nova via composer:

composer require outl1ne/nova-currency-vat-field

Usage

use Outl1ne\NovaCurrencyVatField\CurrencyVAT;

public function fields(Request $request) {
    CurrencyVAT::make('Price', 'price')
      ->VAT(20) // Required, otherwise VAT checkbox isn't rendered
      ->storedWithVAT() // By default with VAT
      ->storedWithoutVAT()
}

Entering prices with VAT, storing them without

By default the checkbox starts out matching how the value is stored. To store the price without VAT, but have the form open with the checkbox checked and the price shown with VAT, use displayedWithVAT():

use Brick\Money\Context\CustomContext;

CurrencyVAT::make('Price', 'price')
  ->VAT(24)
  ->storedWithoutVAT()
  ->displayedWithVAT()
  ->storedDecimals(4) // Decimals of the stored price, defaults to the currency's
  ->context(new CustomContext(4)) // Required by Nova to format a 4 decimal value on Index and Detail views

A price without VAT that's rounded to the currency's decimals can not represent every price with VAT: with 24% VAT 10.00 is stored as 8.06, which is 9.99 with VAT. Storing more decimals (8.0645) avoids that, which is what storedDecimals() is for. The column must be able to hold that many decimals and the option is not meant to be used with asMinorUnits().

A field that is saved without changing its value or checkbox always sends back the exact value it was loaded with.

Credits

License

Nova Currency VAT Field is open-sourced software licensed under the MIT license.