PHP code example of jozenetoz / filament-ptbr-form-fields
1. Go to this page and download the library: Download jozenetoz/filament-ptbr-form-fields library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jozenetoz / filament-ptbr-form-fields example snippets
useJozenetoz\FilamentPtbrFormFields\Document;
//CPF or CNPJ
Document::make('cpf_or_cnpj')
->dynamic()
/*
* app/Currencies/EUR.php
*/declare(strict_types=1);
namespaceApp\Currencies;
useArchTech\Money\Currency;
classEURextendsCurrency{
/*
* Code of the currency.
*/public string $code = 'EUR';
/*
* Name of the currency.
*/public string $name = 'Euro';
/*
* Rate of this currency relative to the default currency.
*/public float $rate = 1.0;
/*
* Number of decimals used in money calculations.
*/public int $mathDecimals = 2;
/*
* Number of decimals used in the formatted value
*/public int $displayDecimals = 2;
/*
* How many decimals of the currency's values should get rounded
*/public int $rounding = 2;
/*
* Prefix placed at the beginning of the formatted value.
*/public string $prefix = '€';
/*
* The language code.
*/public string $locale = 'pt';
/*
* The character used to separate the decimal values.
*/public string $decimalSeparator = '.';
/*
* The character used to separate groups of thousands
*/public string $thousandsSeparator = ',';
}
useJozenetoz\FilamentPtbrFormFields\Cep;
useFilament\Forms\Components\TextInput;
Cep::make('postal_code')
->viaCep(
mode: 'suffix', // Determines whether the action should be appended to (suffix) or prepended to (prefix) the cep field, or not hat corresponds to it.
* More information: https://viacep.com.br/
*/
setFields: [
'street' => 'logradouro',
'number' => 'numero',
'complement' => 'complemento',
'district' => 'bairro',
'city' => 'localidade',
'state' => 'uf'
]
),
TextInput::make('street'),
TextInput::make('number'),
TextInput::make('complement'),
TextInput::make('district'),
TextInput::make('city'),
TextInput::make('state'),
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.