Looking to hire Laravel developers? Try LaraJobs

laravel-nova-price-tax-field maintained by wamesk

Description
A Laravel Nova Price Tax Fields.
Last update
2023/03/16 11:08 (dev-main)
License
Links
Downloads
91
Tags

Comments
comments powered by Disqus

Laravel Nova Price Tax Fields

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'),

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'),