wamesk / laravel-nova-price-tax-field
一个Laravel Nova价格税费字段。
1.2.1
2023-03-16 08:55 UTC
Requires
- php: ^8.1
README
安装
composer require wamesk/laravel-nova-price-tax-field
php artisan vendor:publish --provider="Wame\PriceTaxField\FieldServiceProvider"
使用
添加到您的nova模型
(您可以更改排序字段,但不能在一个列中更改,并且getPriceTaxField必须是最后一个,在迁移中使用十进制或双精度)
添加到您的模型
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'),
配置
rconfig/price-fields.php
翻译
resource/lang/sk/price-fields.php
自定义
在config.price-fields.php
中编辑选项,或者您可以在模型中添加选项
// 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'),