rmsramos / postal-code
与 ViaCep 集成的 CEP 集成
v0.1.1
2024-06-04 18:22 UTC
Requires
- php: ^8.1
- filament/filament: ^3.2
- illuminate/contracts: ^10.0||^11.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.16
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
README
此软件包提供与 ViaCep 集成的 Filament 自定义表单字段。
安装
您可以通过 composer 安装此软件包。
composer require rmsramos/postal-code
用法
use Filament\Forms\Components\TextInput; use Rmsramos\PostalCode\Components\PostalCode; public static function form(Form $form): Form { return $form ->schema([ PostalCode::make('postal_code') ->viaCep( errorMessage: 'CEP inválido.', // Custom message to display if the CEP is invalid. setFields: [ 'street' => 'logradouro', 'number' => 'numero', 'complement' => 'complemento', 'district' => 'bairro', 'city' => 'localidade', 'state' => 'uf' ] ), TextInput::make('street'), TextInput::make('number') ->extraAlpineAttributes([ 'x-on:cep.window' => "\$el.focus()", ]),, TextInput::make('complement'), TextInput::make('district'), TextInput::make('city'), TextInput::make('state'), ]) }
测试
composer test
变更日志
有关最近更改的更多信息,请参阅 变更日志。
贡献
有关详细信息,请参阅 贡献指南。
安全漏洞
请审查 我们的安全策略 了解如何报告安全漏洞。
致谢
许可证
MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件。