PHP code example of abanoubnassem / filament-phone-field
1. Go to this page and download the library: Download abanoubnassem/filament-phone-field library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
abanoubnassem / filament-phone-field example snippets
use AbanoubNassem\FilamentPhoneField\Forms\Components\PhoneInput;
// admin panel
public static function form(Form $form): Form
{
return $form->schema([
...
PhoneInput::make('phone')
// make sure to set Initial Country to null, in the admin panel
// especially if you have multiple records of phone numbers from
// multiple different countries.
->initialCountry(null)
->tel()
]);
}
//frontend-forms
protected function getFormSchema(): array
{
return [
....
PhoneInput::make('phone')
->tel()
];
}
bash
php artisan vendor:publish --tag="filament-phone-field-config"