tapp / select-country-code

一个Laravel Nova选择国家代码字段。

v1.2 2021-03-26 18:13 UTC

This package is auto-updated.

Last update: 2024-09-04 19:33:27 UTC


README

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

Laravel Nova的国家代码选择字段。

外观

表单

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

详情

select-country-code-detail

安装

使用Composer安装

composer require tapp/select-country-code

将国旗图标资产发布到公开项目目录

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

用法

在资源的fields方法中添加字段

use Tapp\SelectCountryCode\SelectCountryCode;

SelectCountryCode::make(__('Country Code')),

选项

iconsDirectory

默认: '/vendor/tapp/nova-select-country-code'.

如果您想使用自定义图像图标,请通过此选项提供图像的目录

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

iconsFormat

默认: 'svg'.

国旗图标的图像格式。

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

options

要显示在选择的选项数组。数组必须包含关联键: 'label''country_code''iso_code'

默认

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

致谢

国家的SVG国旗由

利用的包