freshwork/rut-field 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

freshwork/rut-field

Composer 安装命令:

composer require freshwork/rut-field

包简介

A Laravel Nova field.

README 文档

README

This package adds a Chilean RUT Field to Laravel Nova. It uses this composer package behind the scenes.

  • Formats the input text on keyup or blur
  • Normalizes the format before storing the value on database (without dashes nor dots). You can disable this and store the original text sended by the user.
  • Can validate the value.

Getting started RutField

use Freshwork\RutField\RutField;
// ...

public function fields(Request $request)
{
    return [
        RutField::make('rut')->rules('required|cl_rut');
    ]
}

When to format

By defaultm, on forms, it format the value on keyup. You can change this to blur.

RutField::make('rut')->formatOnBlur();

The format

There are three possible formats:

COMPELTE     12.345.678-9
WITH DASH    12345678-9
ESCAPED      123456789

By default COMPLETE format is used, but you can change it.

RutField::make('rut')->formatComplete();
RutField::make('rut')->formatWithDash();
RutField::make('rut')->formatEscaped();

Validation

As you can check on this composer package, you can use cl_rut laravel validation. If you need a custom validation error, you can override your resources/lang/es/validation.php. I personally use this package: https://github.com/caouecs/Laravel-lang

RutField::make('rut')->rules('required|cl_rut');

Normalize on save

By default, the RUT value is always escaped (ESCAPED format) before saving to database. You can change this with saveWithoutNormalization saving the same text written by the user on the text field.

RutField::make('rut')->saveWithoutNormalization();

Format the field as Chilean RUT/DNI.

Also, you can validate the field using 'cl_rut' laravel validation included on this package: https://github.com/freshworkstudio/ChileanBundle

Screenshot

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固