teguh02/indonesia-territory-forms

显示一个无需播种机的印度尼西亚地区选择表单,适用于邮编内的丝料

v1.1 2024-09-15 01:46 UTC

This package is auto-updated.

Last update: 2024-09-15 01:50:53 UTC


README

Banner

Latest Version on Packagist Total Downloads

功能

  • ✅ 包含印度尼西亚地区:省、市、区、次区及邮编
  • ✅ 缓存查询,使表单更快
  • ✅ 即可使用
  • ✅ 无需播种机

屏幕截图

Screenshot1

Screenshot2

Screenshot3

演示

DEMO

安装

您可以通过composer安装此包

composer require teguh02/indonesia-territory-forms

您可以使用以下命令发布配置文件

php artisan vendor:publish --tag="indonesia-territory-forms-config"

可选,您可以使用以下命令发布语言

php artisan vendor:publish --tag=indonesia-territory-forms-lang

使用方法

组件或自定义页面

要在此包的组件或自定义页面上使用此包,您可以查看以下表单方案示例

use Teguh02\IndonesiaTerritoryForms\IndonesiaTerritoryForms;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            // ... your fields here

            // Call the form
            IndonesiaTerritoryForms::make(),

            // ... your fields here
        ]);
}

迁移

如果您想添加多个列来存储数据,您可以根据您的配置表单名称(您不能在表单名称中创建不同名称的列)创建新列。例如,请参见以下代码

Schema::create('users', function (Blueprint $table) {
    $table->id();
    $table->unsignedBigInteger('province_id')->nullable();
    $table->unsignedBigInteger('city_id')->nullable();
    $table->unsignedBigInteger('district_id')->nullable();
    $table->unsignedBigInteger('subdistrict_id')->nullable();
    $table->unsignedBigInteger('postal_code')->nullable();

    // Your another columns
    $table->string('name');
    $table->string('email')->unique();
});

但是,您仍然可以在迁移中使用 IndonesiaTerritoryForms 类动态创建迁移列名。

Schema::create('users', function (Blueprint $table) {
    $table->id();
    IndonesiaTerritoryForms::make_Columns($table);

    // Your another columns
    $table->string('name');
    $table->string('email')->unique();
});

变更日志

有关最近更改的更多信息,请参阅变更日志

贡献

有关详细信息,请参阅贡献指南

安全漏洞

请审查我们的安全策略,了解如何报告安全漏洞。

致谢

许可

MIT许可证(MIT)。有关更多信息,请参阅许可文件