wamesk/laravel-nova-price-tax-field

A Laravel Nova Price Tax Fields.

1.2.1 2023-03-16 08:55 UTC

This package is auto-updated.

Last update: 2024-05-16 12:34:24 UTC


README

preview

Installation

composer require wamesk/laravel-nova-price-tax-field
php artisan vendor:publish --provider="Wame\PriceTaxField\FieldServiceProvider"

Usage

Add to your nova model
(You can change sort field but not in one column and getPriceTaxField must be last, in migration use decimal or double)

Add to your models

use Wame\PriceTaxField\PriceField;

PriceField::getPriceWithoutTax( config('price-fields'), $this),
PriceField::getPriceTax(config('price-fields'))->rules('required'),
PriceField::getPriceWithTax(config('price-fields'))->rules('required'),
PriceField::getPriceTaxField(config('price-fields'))->rules('required'),

preview

Config

rconfig/price-fields.php

Translate

resource/lang/sk/price-fields.php

Customization

Edit options in config.price-fields.php OR you can add options in your model

// Price tax field options
use Wame\PriceTaxField\PriceField;

$price_tax_options = [
    'db_names'          => ['base_price', 'tax', 'price_with_tax'],
    'names'             => ['bez DPH', 'daň', 's DPH'],
    'base_field_name'   => 'Cena',
    'default_tax'       => 20,
    'one_col'           => true,  // display all fields in one column
    'tax_in_one_col'    => true,  // not show tax value in one column
    'col_classes'       => ['strong', 'small', 'small'],  // classes for rows in column
];
        
PriceField::getPriceWithoutTax( $price_tax_options, $this),
PriceField::getPriceTax($price_tax_options)->rules('required'),
PriceField::getPriceWithTax($price_tax_options)->rules('required'),
PriceField::getPriceTaxField($price_tax_options)->rules('required'),