定制 thienkimlove/nova-money-field-1 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thienkimlove/nova-money-field-1

Composer 安装命令:

composer require thienkimlove/nova-money-field-1

包简介

A Laravel Nova field.

README 文档

README

A custom money field for a Laravel\Nova application I am working on. The default Currency field provided by Nova didn't quite cut the mustard for me so ended up creating this.

  • Works with minor units (both updating and displaying)
  • Displays the amount with the correct currency sign and in the proper locale format
  • Adds the currency sign to the create/update field

Installing

You can install the package into your Nova application via composer:

composer require everestmx/nova-money-field

Using

In your nova resource file, add the following into your Fields method:

use Everestmx\NovaMoneyField\Money;

public function fields (Request $request)
{
	return [
		Money::make('Price'),
	];
}

Options

You can optionally add the column name to be used if different from the display name as per any Nova field:

Money::make('Price', 'price_column');

The default currency is GBP but can be changed per field using currency()

Money::make('Price')->currency('USD');

The default locale is the one set as per the Laravel config('app.locale') file but can be changed per field using locale()

Money::make('Price')->locale('en_US');

By default we assume you are storing values not as minor units, but you can change this with minor(true)

Money::make('Price')->minor(true);

This will automatically format all entered values into minor units so remember to remove any laravel set/get attribute methods on your models!

Advanced

The defaults loaded for this package (Currency, Locale, etc) are loaded within the 'loadDefaults' method within src\Money.php

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固