项目作者: TappNetwork

项目描述 :
Country code select field for Laravel Nova
高级语言: PHP
项目地址: git://github.com/TappNetwork/nova-select-country-code.git
创建时间: 2020-11-13T21:10:09Z
项目社区:https://github.com/TappNetwork/nova-select-country-code

开源协议:

下载


Laravel Nova Country Code Select Field

Latest Version on Packagist
Code Style Action Status - Pint
Total Downloads

A country code select field for Laravel Nova.

Appearance

Form

select-country-code-form
select-country-code-form1

Detail

select-country-code-detail

Installation

Install using Composer:

  1. composer require tapp/select-country-code

Publish the flag icons assets to the public project directory:

  1. php artisan vendor:publish --tag=public --force

Usage

Add the field to your resource in the fields method:

  1. use Tapp\SelectCountryCode\SelectCountryCode;
  2. SelectCountryCode::make(__('Country Code')),

Options

iconsDirectory

Default: '/vendor/tapp/nova-select-country-code'.

If you want to use your own custom image icons, provide the directory of the images with this option:

  1. SelectCountryCode::make(__('Country Code'))
  2. ->iconsDirectory('/public/path/to/icons'),

iconsFormat

Default: 'svg'.

The image format of the flag icons.

  1. SelectCountryCode::make(__('Country Code'))
  2. ->iconsFormat('png'),

options

Array with the options to show on select. The array must contain the associative keys: 'label', 'country_code', and 'iso_code'.

Default:

  1. [
  2. ['label' => 'Afghanistan', 'country_code' => '+93', 'iso_code' => 'AF'],
  3. ['label' => 'Albania', 'country_code' => '+355', 'iso_code' => 'AL'],
  4. // ...
  5. ]
  1. SelectCountryCode::make(__('Country Code'))
  2. ->options($optionsArray),

Credits

SVG of the countries’ flags by:

Leveraged package