1. Go to this page and download the library: Download vernsg/nusa-filament 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/ */
vernsg / nusa-filament example snippets
namespace App\Filament\Resources\Customers\Schemas;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
use Vernsg\NusaFilament\Forms\Components\NusaAddress;
class CustomerForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('name')
->
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Schema::table('customers', function (Blueprint $table): void {
$table->text('address_line')->nullable();
$table->string('province_code')->nullable();
$table->string('regency_code')->nullable();
$table->string('district_code')->nullable();
$table->string('village_code')->nullable();
$table->string('postal_code', 10)->nullable();
});
use Vernsg\NusaFilament\Forms\Components\NusaAddress;
NusaAddress::make();
use Vernsg\NusaFilament\Forms\Components\DistrictSelect;
use Vernsg\NusaFilament\Forms\Components\ProvinceSelect;
use Vernsg\NusaFilament\Forms\Components\RegencySelect;
use Vernsg\NusaFilament\Forms\Components\VillageSelect;
ProvinceSelect::make('province_code');
RegencySelect::make('regency_code')
->provinceField('province_code');
DistrictSelect::make('district_code')
->regencyField('regency_code');
VillageSelect::make('village_code')
->districtField('district_code')
->fillPostalCode('postal_code');
use Vernsg\NusaFilament\Tables\Columns\DistrictColumn;
use Vernsg\NusaFilament\Tables\Columns\ProvinceColumn;
use Vernsg\NusaFilament\Tables\Columns\RegencyColumn;
use Vernsg\NusaFilament\Tables\Columns\VillageColumn;
return $table
->columns([
ProvinceColumn::make('province_code'),
RegencyColumn::make('regency_code'),
DistrictColumn::make('district_code'),
VillageColumn::make('village_code'),
]);
use Vernsg\NusaFilament\Tables\Filters\NusaLocationFilter;
return $table
->filters([
NusaLocationFilter::make('location'),
]);
use Vernsg\NusaFilament\Infolists\Components\NusaAddressEntry;
NusaAddressEntry::make();
use Vernsg\NusaFilament\Infolists\Components\DistrictEntry;
use Vernsg\NusaFilament\Infolists\Components\ProvinceEntry;
use Vernsg\NusaFilament\Infolists\Components\RegencyEntry;
use Vernsg\NusaFilament\Infolists\Components\VillageEntry;
ProvinceEntry::make('province_code');
RegencyEntry::make('regency_code');
DistrictEntry::make('district_code');
VillageEntry::make('village_code');
use Vernsg\NusaFilament\Rules\NusaRules;
[
'province_code' => ['ict_code' => ['usaRules::addressHierarchy(),
],
]