### Example CepInput Configuration Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md This example demonstrates how to create and configure a CepInput component using its public API and method chaining. Customize labels, error messages, and field mappings as needed. ```php CepInput::make('cep') // Configuration method calls ->setMode('prefix') ->setActionLabel('Search') ->setErrorMessage('Invalid') ->setStreetField('street') // ... more configuration ``` -------------------------------- ### Install Filament CEP Field Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/README.md Install the package using Composer. Publish and run the migration files afterwards. ```bash composer require jeffersongoncalves/filament-cep-field php artisan vendor:publish --tag=cep-migrations php artisan migrate ``` -------------------------------- ### Full CEP Input Configuration Example Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/resources/boost/skills/cep-field-development/SKILL.md An example demonstrating a comprehensive configuration of the CEP input field, including custom labels, modes, error messages, and address field mapping. ```php CepInput::make('cep') ->label('Codigo Postal') ->required() ->setMode('prefix') ->setActionLabel('Consultar') ->setActionLabelHidden(false) ->setErrorMessage('CEP nao encontrado ou invalido.') ->setStreetField('endereco') ->setNeighborhoodField('bairro') ->setCityField('cidade') ->setStateField('estado'); ``` -------------------------------- ### CepInput Usage Example Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md Demonstrates how to create and configure the CepInput component using its public API, including chaining configuration methods. ```APIDOC ## CepInput Usage Example ### Description Example of instantiating and configuring the `CepInput` component using its fluent API. ### Code ```php use JeffersonGoncalves\FilamentCepField\CepInput; // Create a new CepInput instance and chain configuration methods CepInput::make('cep') ->label('CEP') ->placeholder('00000-000') ->required() ->setMode('prefix') ->setActionLabel('Search') ->setErrorMessage('Invalid CEP') ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state'); ``` ``` -------------------------------- ### Example Usage of configurePackage Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepFieldServiceProvider.md Demonstrates how to instantiate the service provider and call the configurePackage method to set the package name. This is typically used for testing purposes. ```php $provider = new CepFieldServiceProvider(app()); $package = new Package(); $provider->configurePackage($package); // $package->name is now 'filament-cep-field' ``` -------------------------------- ### Install Filament CEP Field Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/README.md Install the package using Composer and publish migrations for the CEP lookup functionality. ```bash composer require jeffersongoncalves/filament-cep-field # Publish migrations php artisan vendor:publish --tag=cep-migrations php artisan migrate ``` -------------------------------- ### Install Filament CEP Field Plugin Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/resources/boost/skills/cep-field-development/SKILL.md Install the plugin using Composer. This command adds the necessary package to your project. ```bash composer require jeffersongoncalves/filament-cep-field ``` -------------------------------- ### Set SSL Certificate via Environment Variable Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/README.md Example of setting the SSL certificate file path using an environment variable. Not recommended for production. ```bash export SSL_CERT_FILE=/path/to/cacert.pem ``` -------------------------------- ### CEP Input with Method Chaining Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepInput.md This comprehensive example showcases method chaining for configuring the CepInput component. It includes setting the mode, action label, error message, field mappings, minimum length, and placeholder. ```php CepInput::make('cep') ->label('CEP') ->required() ->setMode('prefix') ->setActionLabel('Buscar') ->setErrorMessage('CEP inválido.') ->setStreetField('street_address') ->setNeighborhoodField('neighborhood_name') ->setCityField('city_name') ->setStateField('state_code') ->minLength(9) ->placeholder('00000-000') ``` -------------------------------- ### CEP Input with Prefix Button and Custom Messages Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepInput.md This example demonstrates configuring the CepInput with a prefix button for manual lookup, a custom error message for invalid CEPs, and mapping address fields to specific names. ```php CepInput::make('cep') ->label('CEP') ->setMode('prefix') ->setActionLabel('Consultar') ->setActionLabelHidden(false) ->setErrorMessage('CEP não encontrado ou inválido.') ->setStreetField('address_street') ->setNeighborhoodField('address_neighborhood') ->setCityField('address_city') ->setStateField('address_state') ``` -------------------------------- ### Configure SSL Verification with Laravel HTTP Client Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/README.md Example of configuring SSL certificate verification using options within Laravel's HTTP client. ```php Http::withOptions([ 'verify' => '/path/to/cacert.pem' ])->get('https://api.example.com'); ``` -------------------------------- ### Run Package Tests Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/errors.md Execute the package's test suite to check for CEP lookup failures and other error scenarios. Refer to the test file for specific examples. ```bash composer test ``` -------------------------------- ### Multi-Step Form with Address Lookup Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/USAGE_PATTERNS.md Implement a wizard-style form with an address verification step using CepInput. This pattern is useful for guiding users through a multi-stage data entry process. ```php use Filament\Forms\Form; use Filament\Wizard\Step; use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; public function form(Form $form): Form { return $form ->schema([ Step::make('Personal Information') ->schema([ TextInput::make('name') ->label('Full Name') ->required(), TextInput::make('email') ->label('Email') ->required(), ]), Step::make('Address') ->schema([ CepInput::make('cep') ->label('CEP') ->required() ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state'), TextInput::make('street') ->label('Street') ->required(), TextInput::make('neighborhood') ->label('Neighborhood') ->required(), TextInput::make('city') ->label('City') ->required(), TextInput::make('state') ->label('State') ->required(), TextInput::make('number') ->label('Number') ->required(), ]) ->columns(2), Step::make('Review') ->schema([ // Review fields ]), ]) ->steps(3) ->nextButtonLabel('Next') ->previousButtonLabel('Back') ->submitButtonLabel('Submit'); } ``` -------------------------------- ### CepInput Component API Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/DOCUMENTATION_SUMMARY.txt Documentation for the CepInput component, including all public methods, parameter types, return values, and usage examples. ```APIDOC ## CepInput Component API Reference ### Description Provides the main form component for CEP (postal code) input and address lookup integration within Filament forms. ### Public Methods #### Factory Methods - **make()**: Creates a new instance of the CepInput component. #### Configuration Methods - **setMode(string $mode)**: Sets the button position. Accepts 'prefix' or 'suffix'. - **setActionLabel(string $label)**: Sets the text for the search button. - **setActionLabelHidden(bool $condition)**: Determines whether to show or hide the search button label. - **setErrorMessage(string $message)**: Customizes the validation error message when a CEP is not found. - **setStreetField(string $fieldName)**: Maps the component to a specific street field in the form. - **setNeighborhoodField(string $fieldName)**: Maps the component to a specific neighborhood field in the form. - **setCityField(string $fieldName)**: Maps the component to a specific city field in the form. - **setStateField(string $fieldName)**: Maps the component to a specific state field in the form. ### Inherited Methods Inherits all methods from Filament's `TextInput` component. ``` -------------------------------- ### Custom Portuguese Error Message Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/errors.md Example of configuring a custom error message in Portuguese for CEP lookup failures. ```php CepInput::make('cep') ->label('CEP') ->required() ->setErrorMessage('CEP não encontrado no banco de dados.') ``` -------------------------------- ### Custom Error Message Example Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/README.md Demonstrates how to set a custom error message for the CEP field when a lookup fails. This is useful for providing more specific feedback to the user. ```php CepInput::make('cep') ->setErrorMessage('CEP não encontrado ou inválido.') ``` -------------------------------- ### Usage in Filament Forms Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/README.md Shows how to integrate the CepInput component within a Filament form schema. It includes basic setup and association with other related text input fields for address details. ```php use Filament\Forms\Form; use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; public function form(Form $form): Form { return $form->schema([ TextInput::make('name') ->label('Full Name') ->required(), CepInput::make('cep') ->label('CEP') ->required() ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state'), TextInput::make('street') ->label('Street') ->required(), TextInput::make('neighborhood') ->label('Neighborhood') ->required(), TextInput::make('city') ->label('City') ->required(), Select::make('state') ->label('State') ->required() ->options([ 'SP' => 'São Paulo', 'RJ' => 'Rio de Janeiro', // ... more states ]), ]); } ``` -------------------------------- ### Form Submission with Invalid CEP Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/errors.md This example shows a Filament form schema including CepInput. It demonstrates how form submission is blocked if the CEP field is invalid or fails lookup, highlighting the error. ```php // In your Filament form public function form(Form $form): Form { return $form->schema([ CepInput::make('cep') ->label('CEP') ->required() ->setErrorMessage('CEP não encontrado.'), TextInput::make('street') ->label('Street') ->required(), // ... more fields ]); // Form submission blocked if: // - 'cep' field required but empty // - 'cep' field value fails CEP lookup // - 'street' or other required fields empty } ``` -------------------------------- ### CepInput Validation Rules Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/errors.md CepInput automatically applies validation rules for minimum length and format. This example shows how to combine these with custom error messages for lookup failures. ```php CepInput::make('cep') ->label('CEP') ->required() // Field required error ->setErrorMessage('CEP não encontrado.') // Lookup failed error ``` -------------------------------- ### Create a Custom Default CepInput Component Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/configuration.md Illustrates creating a custom component that extends CepInput to apply default configurations globally. ```php // app/Forms/Components/DefaultCepInput.php namespace App\Forms\Components; use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; class DefaultCepInput extends CepInput { protected static function getDefaultName(): ?string { return 'cep'; } public function setUp(): void { parent::setUp(); // Set your defaults here $this->setMode('prefix'); $this->setActionLabel('Buscar'); $this->setErrorMessage('CEP não encontrado.'); } } ``` ```php // Usage DefaultCepInput::make('cep'); // Already has your custom defaults applied ``` -------------------------------- ### Custom English Error Message Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/errors.md Example of configuring a custom error message in English for CEP lookup failures. ```php CepInput::make('cep') ->label('Postal Code') ->required() ->setErrorMessage('This postal code does not exist.') ``` -------------------------------- ### Configure CepInput with Method Chaining Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/configuration.md Demonstrates chaining setter methods to configure CepInput instance properties like mode, labels, and field mappings. ```php CepInput::make('cep') ->setMode('prefix') ->setActionLabel('Buscar') ->setErrorMessage('CEP não encontrado.') ->setStreetField('street_address') ->setNeighborhoodField('neighborhood_name') ->setCityField('city_name') ->setStateField('state_code') ``` -------------------------------- ### Publish and Run CEP Migrations Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/resources/boost/skills/cep-field-development/SKILL.md Publish the migration files for CEP database caching and then run the migrations to set up the cache table. ```bash php artisan vendor:publish --tag=cep-migrations php artisan migrate ``` -------------------------------- ### Manual Instantiation for Testing Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepFieldServiceProvider.md Illustrates how to manually instantiate the CepFieldServiceProvider for testing purposes, asserting its type. ```php use JeffersonGoncalves\Filament\CepField\CepFieldServiceProvider; $provider = new CepFieldServiceProvider(app()); expect($provider)->toBeInstanceOf(CepFieldServiceProvider::class); ``` -------------------------------- ### Configure CepInput with Inherited TextInput Options Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/configuration.md Demonstrates using both CepInput-specific setters and inherited Filament TextInput configuration methods. ```php CepInput::make('cep') // CepInput-specific ->setMode('prefix') ->setErrorMessage('Custom error') // Inherited from TextInput ->label('CEP') ->placeholder('00000-000') ->required() ->disabled(false) ->helperText('Enter your CEP') ->hint('Brazilian postal code') ->prefixIcon('heroicon-o-user') ->suffixIcon('heroicon-o-check') ->autoCompleted() ``` -------------------------------- ### Method Chaining for CepInput Configuration Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/README.md Illustrates extensive method chaining to configure all available options for the CepInput component, including inherited TextInput methods. This allows for fluent and comprehensive customization. ```php CepInput::make('cep') ->label('CEP') ->placeholder('00000-000') ->required() ->setMode('prefix') ->setActionLabel('Consultar') ->setActionLabelHidden(false) ->setErrorMessage('CEP não encontrado.') ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state') ->helperText('Digite seu CEP') ->disabled(false) ``` -------------------------------- ### Create CepInput Instance Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepInput.md Creates a new CepInput instance using the static make() method. This is the primary way to initiate a CepInput field. ```php use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; $cepField = CepInput::make('cep'); ``` -------------------------------- ### Combine CepInput and TextInput Configurations Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/configuration.md Shows how to chain CepInput-specific setters with inherited Filament TextInput methods for comprehensive field configuration. ```php CepInput::make('cep') ->label('CEP') ->required() ->setMode('prefix') ->placeholder('00000-000') ->setActionLabel('Search') ->helperText('Enter your postal code') ->disabled(false) ``` -------------------------------- ### CepInput::make() Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepInput.md Creates a new CepInput instance. This is the primary method for initializing the CEP input field. ```APIDOC ## CepInput::make() ### Description Creates a new CepInput instance. Inherited from Filament's TextInput, this is the entry point for all CepInput usage. ### Method `public static function make(string $name): static` ### Parameters #### Path Parameters - **name** (string) - Required - The field name/key for form state ### Return Type `static` (CepInput instance) ### Description Automatically applies: - CEP mask format: `99999-999` - Minimum length validation: 9 characters - State update hook for address lookup - Suffix or prefix action based on mode configuration ### Example ```php use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; $cepField = CepInput::make('cep'); ``` ``` -------------------------------- ### CepInput Configuration Methods Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md These public methods allow you to configure the behavior and appearance of the CepInput component. All configuration methods return the static instance, enabling method chaining. ```php public function setMode(string $mode): static; public function setActionLabel(string $actionLabel): static; public function setActionLabelHidden(bool $actionLabelHidden): static; public function setErrorMessage(string $errorMessage): static; public function setStreetField(string $streetField): static; public function setNeighborhoodField(string $neighborhoodField): static; public function setCityField(string $cityField): static; public function setStateField(string $stateField): static; ``` -------------------------------- ### Setting Custom Error Messages for CEP Lookup Failures Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/USAGE_PATTERNS.md Use this pattern to provide users with a clear, informative message when a CEP lookup fails. It helps guide users on potential issues and the expected format. ```php use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; CepInput::make('cep') ->label('CEP') ->required() ->placeholder('00000-000') ->setErrorMessage( 'This postal code was not found. ' . 'Please verify the digits and try again. ' . 'Valid Brazilian CEP format: 00000-000' ) ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state') ``` -------------------------------- ### Creating a Reusable Custom CEP Input Component Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/USAGE_PATTERNS.md This pattern demonstrates how to create a reusable custom component by extending the base CepInput. It allows you to define standard configurations, such as labels, error messages, and field mappings, in one place, promoting consistency across multiple forms. ```php // app/Forms/Components/AddressCepInput.php namespace App\Forms\Components; use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput as BaseCepInput; class AddressCepInput extends BaseCepInput { // Define your standard configuration protected static function getDefaultName(): ?string { return 'cep'; } public function setUp(): void { parent::setUp(); // Apply your organization's standard configuration $this ->label('CEP') ->setActionLabel('Search Address') ->setErrorMessage('Address not found for this postal code.') ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state') ->helperText('Enter your postal code to auto-fill address fields'); } } // Usage in forms use App\Forms\Components\AddressCepInput; public function form(Form $form): Form { return $form->schema([ AddressCepInput::make('cep')->required(), // ... other fields ]); } ``` -------------------------------- ### Publish Package Assets Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepFieldServiceProvider.md Provides bash commands for publishing package assets, including migrations and all other assets, using the service provider's fully qualified name. ```bash # Publish migrations (if configured) php artisan vendor:publish --tag=cep-migrations # Publish all assets from this package php artisan vendor:publish --provider="JeffersonGoncalves\Filament\CepField\CepFieldServiceProvider" ``` -------------------------------- ### Running Tests Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/README.md Provides commands to execute the package's test suite, including options for coverage and code style checks. These commands are essential for verifying package integrity and adherence to coding standards. ```bash # Run tests composer test # Run with coverage composer test-coverage # Code style check composer format # Static analysis composer analyse ``` -------------------------------- ### Download cacert.pem using curl Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/README.md Command to download the latest CA certificate bundle from the official cURL website. ```bash # Download the latest cacert.pem file curl -o cacert.pem https://curl.se/ca/cacert.pem ``` -------------------------------- ### Minimal CepInput Configuration Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/configuration.md Basic configuration for CepInput, using default settings for most options while setting a label and making the field required. ```php use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; CepInput::make('cep') ->label('CEP') ->required() ``` -------------------------------- ### CEP Input with Prefix Button and Custom Labels Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/README.md Sets up the CepInput component with a prefix button for action, custom button label, and a specific error message. ```php CepInput::make('cep') ->label('Código Postal') ->setMode('prefix') ->setActionLabel('Consultar') ->setActionLabelHidden(false) ->setErrorMessage('CEP não encontrado ou inválido.') ``` -------------------------------- ### Instantiate CepFieldServiceProvider Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md This snippet shows how to manually instantiate the CepFieldServiceProvider. In most cases, Laravel automatically discovers and registers this service provider, so manual instantiation is typically only needed for testing. ```php use JeffersonGoncalves\Filament\CepField\CepFieldServiceProvider; $provider = new CepFieldServiceProvider(app()); ``` -------------------------------- ### Configuration Options Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/DOCUMENTATION_SUMMARY.txt Reference for all available configuration options for the Filament Cep Field package. ```APIDOC ## Configuration Options ### Description These options allow customization of the CepInput component's behavior and appearance. ### Options - **setMode(string $mode)**: Button position. Accepts 'prefix' or 'suffix'. - **setActionLabel(string $label)**: Search button text. - **setActionLabelHidden(bool $condition)**: Show/hide label. - **setErrorMessage(string $message)**: Validation error message. - **setStreetField(string $fieldName)**: Street field mapping. - **setNeighborhoodField(string $fieldName)**: Neighborhood field mapping. - **setCityField(string $fieldName)**: City field mapping. - **setStateField(string $fieldName)**: State field mapping. ### Method Chaining All configuration methods support method chaining for concise setup. ``` -------------------------------- ### CepFieldServiceProvider Public Methods Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md The service provider class for registering the package. It contains a method to configure the package during application bootstrap. ```APIDOC ## CepFieldServiceProvider Public Methods ### Description Provides the public API for the service provider, responsible for package registration and configuration. ### Method #### `configurePackage(Package $package): void` Configures the package using the provided `Package` instance. This method is called during the application's booting process. ``` -------------------------------- ### Configure Package Method Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepFieldServiceProvider.md The configurePackage method sets the unique name for the package, which is essential for asset publishing and other package-related operations. ```php public function configurePackage(Package $package): void ``` -------------------------------- ### Import Individual CepInput Class Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md Demonstrates how to import the CepInput class for use in your Filament forms. This allows you to create and configure CEP input fields. ```php use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; $field = CepInput::make('cep'); ``` -------------------------------- ### CepInput Configuration Methods Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepInput.md Provides methods to configure the behavior and appearance of the CepInput component, such as button position, error messages, and labels. ```APIDOC ## CepInput Configuration Methods All methods return `static` (the CepInput instance) to enable method chaining. ### setMode() #### Description Sets the position of the search action button relative to the input field. #### Method `public function setMode(string $mode): static` #### Parameters - **mode** (string) - Required - Position of the search action button: `'prefix'` or `'suffix'` #### Return Type `static` #### Example ```php CepInput::make('cep') ->setMode('prefix') ``` ### setErrorMessage() #### Description Sets the validation error message displayed when CEP lookup fails or returns no results. #### Method `public function setErrorMessage(string $errorMessage): static` #### Parameters - **errorMessage** (string) - Required - Custom validation error message when CEP lookup fails or is invalid #### Return Type `static` #### Example ```php CepInput::make('cep') ->setErrorMessage('CEP não encontrado ou inválido.') ``` ### setActionLabel() #### Description Sets the text label for the search/lookup button. Only displayed when `setActionLabelHidden()` is `false`. #### Method `public function setActionLabel(string $actionLabel): static` #### Parameters - **actionLabel** (string) - Required - Text label for the search action button #### Return Type `static` #### Example ```php CepInput::make('cep') ->setActionLabel('Consultar') ``` ### setActionLabelHidden() #### Description Controls button appearance. When `true`, only the magnifying glass icon is shown. When `false`, both icon and text label are displayed. #### Method `public function setActionLabelHidden(bool $actionLabelHidden): static` #### Parameters - **actionLabelHidden** (bool) - Required - Whether to hide the action button label, showing only the icon #### Return Type `static` #### Example ```php CepInput::make('cep') ->setActionLabelHidden(true) // Shows only icon ``` ``` -------------------------------- ### Full Custom CepInput Configuration Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/configuration.md Demonstrates a comprehensive configuration of CepInput, customizing all available options including display, labels, messages, field mapping, and inheriting standard Filament TextInput features like placeholder and helper text. ```php CepInput::make('cep') ->label('Brazilian Postal Code') ->placeholder('00000-000') ->required() ->setMode('prefix') ->setActionLabel('Verify') ->setActionLabelHidden(false) ->setErrorMessage('Postal code not found in database.') ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state') ->helperText('Enter your CEP code') ``` -------------------------------- ### Default CepInput Configuration Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/configuration.md Shows the default settings for CepInput when no custom methods are called. This includes button position, labels, error messages, and field mappings. ```php use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; // Default configuration (no method calls) CepInput::make('cep') // Button position: right side of input // Mode: 'suffix' // Search button text: "Buscar CEP" (Portuguese: "Search CEP") // Label: 'Buscar CEP' // Show both icon and text // Label hidden: false // Error message in Portuguese // Error: 'CEP inválido.' // Field mapping - matches common naming conventions // Street field: 'street' // Neighborhood field: 'neighborhood' // City field: 'city' // State field: 'state' ``` -------------------------------- ### Custom English CepInput Configuration Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/configuration.md Configures CepInput with English labels and messages, and sets the search button to appear on the left side (prefix). ```php CepInput::make('cep') ->label('Postal Code') ->required() ->setActionLabel('Search') ->setErrorMessage('Invalid postal code.') ->setMode('prefix') ``` -------------------------------- ### PHP Configuration for SSL Certificates Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/README.md Configuration settings for php.ini to specify the CA certificate file for SSL verification. ```ini ; Enable SSL certificate verification openssl.cafile = "C:\\php\\extras\\ssl\\cacert.pem" ; Windows path ; openssl.cafile = "/etc/ssl/certs/cacert.pem" ; Linux/macOS path ; For cURL specifically curl.cainfo = "C:\\php\\extras\\ssl\\cacert.pem" ; Windows path ; curl.cainfo = "/etc/ssl/certs/cacert.pem" ; Linux/macOS path ``` -------------------------------- ### PHP Configuration for SSL Certificate Errors Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/resources/boost/skills/cep-field-development/SKILL.md Configure PHP's `openssl.cafile` and `curl.cainfo` directives in `php.ini` to resolve SSL certificate verification issues when connecting to CEP APIs. Ensure the `cacert.pem` file is downloaded and placed in the specified path. ```ini openssl.cafile = "C:\\php\\extras\\ssl\\cacert.pem" curl.cainfo = "C:\\php\\extras\\ssl\\cacert.pem" ``` -------------------------------- ### Importing Filament Form Components Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md To use Filament form features, import the necessary components directly from the Filament library. This is a standard practice when building forms with Filament. ```php use Filament\Forms\Components\TextInput; use Filament\Forms\Components\Select; ``` -------------------------------- ### Initialize CEP Input Component Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepInput.md This protected method is automatically called by Filament during component initialization. It sets up default configurations like input masking, validation, and state update hooks for address lookups. ```php protected function setUp(): void { // Applies input mask 99999-999 // Sets minimum input length to 9 characters // Registers afterStateUpdated hook that triggers findByCep() // Configures suffix action when mode is 'suffix' // Configures prefix action when mode is 'prefix' } ``` -------------------------------- ### Advanced CepInput Usage with Options Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/README.md Configure CepInput with various options for mode, labels, error messages, and field mappings. ```php use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; // Advanced usage with all available options CepInput::make('cep') ->required() ->setMode('suffix') // 'prefix' or 'suffix' (default: 'suffix') ->setActionLabel('Buscar CEP') // Custom search button label ->setActionLabelHidden(false) // Show/hide action label (default: false) ->setErrorMessage('CEP não encontrado.') // Custom error message ->setStreetField('street') // Field to populate with street name ->setNeighborhoodField('neighborhood') // Field to populate with neighborhood ->setCityField('city') // Field to populate with city name ->setStateField('state'), // Field to populate with state ``` -------------------------------- ### Instantiate CepInput Form Component Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md Use this snippet to create a new instance of the CepInput form component. This component is designed for Brazilian postal codes and integrates with Filament's form system. ```php use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; $field = CepInput::make('cep_field_name'); ``` -------------------------------- ### CepInput Return Types Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md This section details the return types for CepInput methods. Most configuration methods return the static instance for chaining, while the factory method also returns static. ```php // All configuration methods return static (CepInput) setMode(...): static setActionLabel(...): static // ... etc // Factory method returns static make(...): static // Service provider method returns void configurePackage(...): void ``` -------------------------------- ### Configure CepInput Mode Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepInput.md Sets the position of the search action button relative to the input field. Use 'prefix' for left placement or 'suffix' for right placement. ```php CepInput::make('cep') ->setMode('prefix') ``` -------------------------------- ### Package Namespace Imports Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/README.md Import necessary classes from the package's namespace. This includes the main CepInput form component and the CepFieldServiceProvider. ```php use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; use JeffersonGoncalves\Filament\CepField\CepFieldServiceProvider; ``` -------------------------------- ### Test SSL Connection in PHP Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/README.md PHP code snippet to test the SSL configuration by making a request to an external API. ```php // Test SSL connection $response = file_get_contents('https://brasilapi.com.br/api/cep/v1/01310100'); if ($response !== false) { echo "SSL configuration is working correctly!"; } else { echo "SSL configuration needs attention."; } ``` -------------------------------- ### Create CEP Search Action Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepInput.md This private method constructs and configures the search action button for the CEP input. It defines the icon, label, and the callback function that executes the CEP lookup. ```php private function makeCepAction(): Filament\Actions\Action { // Returns an action with: // - Icon: 'heroicon-o-magnifying-glass' // - Label: From $this->actionLabel // - Callback: Executes findByCep() // - Button style: Applied only if $this->actionLabelHidden is false } ``` -------------------------------- ### CepInput Factory Method Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md Use this static factory method to create a new instance of the CepInput component. It requires a unique name for the form field. ```php public static function make(string $name): static; ``` -------------------------------- ### Configure CepInput Action Label Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepInput.md Sets the text label for the search action button. This label is visible when setActionLabelHidden() is false. ```php CepInput::make('cep') ->setActionLabel('Consultar') ``` -------------------------------- ### CepInput Public Methods Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md Provides methods for creating and configuring the CepInput form component. It extends Filament's TextInput and offers specific methods for CEP-related functionality. ```APIDOC ## CepInput Public Methods ### Description Methods for creating and configuring the CepInput form component, extending Filament's TextInput. ### Factory Method #### `make(string $name): static` Creates a new instance of the CepInput component. ### Configuration Methods These methods configure the CepInput component and return `static` to allow for method chaining. - **`setMode(string $mode): static`**: Sets the input mode (e.g., 'prefix'). - **`setActionLabel(string $actionLabel): static`**: Sets the label for the action button. - **`setActionLabelHidden(bool $actionLabelHidden): static`**: Hides or shows the action button label. - **`setErrorMessage(string $errorMessage): static`**: Sets the custom error message for invalid CEPs. - **`setStreetField(string $streetField): static`**: Maps the CEP lookup result to a specific street field name. - **`setNeighborhoodField(string $neighborhoodField): static`**: Maps the CEP lookup result to a specific neighborhood field name. - **`setCityField(string $cityField): static`**: Maps the CEP lookup result to a specific city field name. - **`setStateField(string $stateField): static`**: Maps the CEP lookup result to a specific state field name. ### Inherited Methods Includes over 50 methods from `Filament\Forms\Components\TextInput`, such as `label()`, `placeholder()`, `required()`, `disabled()`, and `helperText()`. ``` -------------------------------- ### Organize Address Fields in a Collapsible Section Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/USAGE_PATTERNS.md Use Filament's Section component to group address-related fields, including the CepInput. This pattern allows for better form organization and can be collapsed to save space. ```php use Filament\Forms\Components\Section; use Filament\Forms\Form; use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; use Filament\Forms\Components\TextInput; public function form(Form $form): Form { return $form->schema([ Section::make('Personal Information') ->schema([ TextInput::make('name') ->label('Full Name') ->required(), TextInput::make('email') ->label('Email') ->required(), ]) ->columns(2), Section::make('Address') ->description('Enter your postal code to auto-fill address information') ->schema([ CepInput::make('cep') ->label('CEP (Postal Code)') ->required() ->columnSpanFull() ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state'), TextInput::make('street') ->label('Street') ->required(), TextInput::make('number') ->label('Number') ->required(), TextInput::make('complement') ->label('Complement') ->required(false), TextInput::make('neighborhood') ->label('Neighborhood') ->required(), TextInput::make('city') ->label('City') ->required(), TextInput::make('state') ->label('State') ->required(), ]) ->columns(2), Section::make('Additional Information') ->schema([ TextInput::make('phone') ->label('Phone') ->required(), ]) ->collapsed(true), ]); } ``` -------------------------------- ### Real-time Client-Side Feedback Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/errors.md This snippet illustrates how errors are displayed in real-time to the user, including when the field is empty, on blur, on value change, or via a manual search trigger. ```php CepInput::make('cep') ->label('CEP') ->required() ->setErrorMessage('CEP inválido.') // Error displayed immediately when: // 1. Field is empty (if required) // 2. User leaves field (blur event triggers validation) // 3. User changes value (state update triggers lookup) // 4. User clicks search button (manual trigger) ``` -------------------------------- ### Pre-filling Address Fields in an Edit Form Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/USAGE_PATTERNS.md This pattern demonstrates how to use CepInput in an edit form to automatically populate address fields based on an existing CEP. Users can then edit the CEP to update the address. ```php use Filament\Forms\Form; use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; // In your Edit page or resource public function form(Form $form): Form { return $form->schema([ CepInput::make('cep') ->label('CEP') ->required() ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state'), TextInput::make('street') ->label('Street') ->required(), // ... other fields ]); } // The form is automatically populated with existing record data // User can change CEP to update address fields ``` -------------------------------- ### CepFieldServiceProvider Class Structure Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepFieldServiceProvider.md Defines the CepFieldServiceProvider class, extending Spatie's PackageServiceProvider. It is used to configure the package name. ```php class CepFieldServiceProvider extends PackageServiceProvider { public function configurePackage(Package $package): void { $package->name('filament-cep-field'); } } ``` -------------------------------- ### Bilingual CEP Input Configuration Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/USAGE_PATTERNS.md Configure CepInput for different languages by creating separate classes for each locale. This allows dynamic selection of labels, placeholders, and action/error messages based on the application's current locale. ```php use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; class PortugueseVersion { public static function cepField(): CepInput { return CepInput::make('cep') ->label('CEP') ->placeholder('00000-000') ->setActionLabel('Buscar') ->setErrorMessage('CEP não encontrado ou inválido.') ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state'); } } class EnglishVersion { public static function cepField(): CepInput { return CepInput::make('cep') ->label('Postal Code') ->placeholder('00000-000') ->setActionLabel('Search') ->setErrorMessage('Postal code not found or invalid.') ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state'); } } // Usage public function form(Form $form): Form { $cepField = app()->getLocale() === 'pt_BR' ? PortugueseVersion::cepField() : EnglishVersion::cepField(); return $form->schema([$cepField]); } ``` -------------------------------- ### CEP Input with Icon-Only Search Button Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepInput.md Configure the CepInput to display only an icon (magnifying glass) for the search action, using the 'suffix' mode. This provides a cleaner UI when a text label for the button is not desired. ```php CepInput::make('cep') ->label('CEP') ->setActionLabelHidden(true) // Shows only magnifying glass icon ->setMode('suffix') ->required() ``` -------------------------------- ### CepInput Parameter Types Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/MODULE_INDEX.md This section outlines the expected parameter types for various CepInput methods. Ensure you pass the correct data types to maintain functionality. ```php // String parameters setMode(string): static setActionLabel(string): static setErrorMessage(string): static setStreetField(string): static setNeighborhoodField(string): static setCityField(string): static setStateField(string): static // Boolean parameter setActionLabelHidden(bool): static // Factory method make(string): static ``` -------------------------------- ### Basic CepInput Usage Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/README.md Use the CepInput component in your Filament forms for basic CEP input. ```php use JeffersonGoncalves\Filament\CepField\Forms\Components\CepInput; // Basic usage CepInput::make('cep') ->required(), ``` -------------------------------- ### Composer.json Package Registration Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/api-reference/CepFieldServiceProvider.md Shows how the CepFieldServiceProvider is automatically registered in Laravel via the 'extra.laravel.providers' key in the composer.json file. ```json { "extra": { "laravel": { "providers": [ "JeffersonGoncalves\Filament\CepField\CepFieldServiceProvider" ] } } } ``` -------------------------------- ### CEP Input with Address Auto-Population Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/resources/boost/skills/cep-field-development/SKILL.md Configure the CEP input to automatically populate street, neighborhood, city, and state fields upon a successful CEP lookup. ```php CepInput::make('cep') ->label('CEP') ->required() ->setStreetField('street') ->setNeighborhoodField('neighborhood') ->setCityField('city') ->setStateField('state'); ``` -------------------------------- ### CepInput with Custom Configuration Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/README.md Customize the behavior and appearance of the CepInput component, including button positioning, action label, and error messages. The 'setMode' method accepts 'prefix' or 'suffix'. ```php CepInput::make('cep') ->label('CEP') ->required() ->setMode('prefix') ->setActionLabel('Buscar') ->setActionLabelHidden(false) ->setErrorMessage('CEP não encontrado ou inválido.') ``` -------------------------------- ### Icon-Only Button Configuration Source: https://github.com/jeffersongoncalves/filament-cep-field/blob/3.x/_autodocs/configuration.md Configures CepInput to display only an icon for the search button, hiding the text label to save space. The button is positioned on the right. ```php CepInput::make('cep') ->label('CEP') ->setActionLabelHidden(true) ->setMode('suffix') ->required() ```