greg0x46/masked-field

A Laravel Nova field.

Downloads

79

Stars

0

Version

v1.0.1

Laravel Nova Masked Field

Installation

composer require greg0x46/masked-field

Usage

Import it in your resources and add the InputMask to fields method.

use Greg0x46\MaskedField\MaskedField;

public function fields(Request $request)
{
    return [
        MaskedField::make('Phone')
            ->mask('(###) ###-####'),
    ];
}

masked-field-demo

Mask syntax

Default tokens:

{
    '#': { pattern: /[0-9]/ },
    'X': { pattern: /[0-9a-zA-Z]/ },
    'S': { pattern: /[a-zA-Z]/ },
    'A': { pattern: /[a-zA-Z]/, uppercase: true },
    'a': { pattern: /[a-zA-Z]/, lowercase: true },
    '!': { escape: true },
    '*': { repeat: true }
}

See more

References

greg0x46

Author

greg0x46