PHP code example of teguh02 / indonesia-territory-forms

1. Go to this page and download the library: Download teguh02/indonesia-territory-forms 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/ */

    

teguh02 / indonesia-territory-forms example snippets


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();
});

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

    // Your another columns
    $table->string('name');
    $table->string('email')->unique();
});
bash
php artisan vendor:publish --tag="indonesia-territory-forms-config"
bash
php artisan vendor:publish --tag=indonesia-territory-forms-lang