add spatial plannings retribution calculations
This commit is contained in:
148
database/seeders/BuildingFunctionParameterSeeder.php
Normal file
148
database/seeders/BuildingFunctionParameterSeeder.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\BuildingFunction;
|
||||
use App\Models\BuildingFunctionParameter;
|
||||
|
||||
class BuildingFunctionParameterSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$parameters = [
|
||||
// Fungsi Keagamaan
|
||||
[
|
||||
'building_function_code' => 'AGAMA',
|
||||
'fungsi_bangunan' => 0,
|
||||
'ip_permanen' => 0,
|
||||
'ip_kompleksitas' => 0,
|
||||
'indeks_lokalitas' => 0,
|
||||
'asumsi_prasarana' => 0.5,
|
||||
'is_active' => true,
|
||||
'notes' => 'Parameter untuk fungsi keagamaan'
|
||||
],
|
||||
|
||||
// Fungsi Sosial Budaya
|
||||
[
|
||||
'building_function_code' => 'SOSIAL_BUDAYA',
|
||||
'fungsi_bangunan' => 0.3,
|
||||
'ip_permanen' => 0.4,
|
||||
'ip_kompleksitas' => 0.6,
|
||||
'indeks_lokalitas' => 0.3,
|
||||
'asumsi_prasarana' => 0.5,
|
||||
'is_active' => true,
|
||||
'notes' => 'Parameter untuk fungsi sosial budaya'
|
||||
],
|
||||
|
||||
// Fungsi Campuran Kecil
|
||||
[
|
||||
'building_function_code' => 'CAMPURAN_KECIL',
|
||||
'fungsi_bangunan' => 0.6,
|
||||
'ip_permanen' => 0.4,
|
||||
'ip_kompleksitas' => 0.6,
|
||||
'indeks_lokalitas' => 0.5,
|
||||
'asumsi_prasarana' => 0.5,
|
||||
'is_active' => true,
|
||||
'notes' => 'Parameter untuk fungsi campuran kecil'
|
||||
],
|
||||
|
||||
// Fungsi Campuran Besar
|
||||
[
|
||||
'building_function_code' => 'CAMPURAN_BESAR',
|
||||
'fungsi_bangunan' => 0.8,
|
||||
'ip_permanen' => 0.4,
|
||||
'ip_kompleksitas' => 0.6,
|
||||
'indeks_lokalitas' => 0.5,
|
||||
'asumsi_prasarana' => 0.5,
|
||||
'is_active' => true,
|
||||
'notes' => 'Parameter untuk fungsi campuran besar'
|
||||
],
|
||||
|
||||
// UMKM (Usaha Kecil)
|
||||
[
|
||||
'building_function_code' => 'USAHA_KECIL',
|
||||
'fungsi_bangunan' => 0.5,
|
||||
'ip_permanen' => 0.4,
|
||||
'ip_kompleksitas' => 0.6,
|
||||
'indeks_lokalitas' => 0.4,
|
||||
'asumsi_prasarana' => 0.5,
|
||||
'is_active' => true,
|
||||
'notes' => 'Parameter untuk UMKM'
|
||||
],
|
||||
|
||||
// Usaha Besar (Non-Mikro)
|
||||
[
|
||||
'building_function_code' => 'USAHA_BESAR',
|
||||
'fungsi_bangunan' => 0.7,
|
||||
'ip_permanen' => 0.4,
|
||||
'ip_kompleksitas' => 0.6,
|
||||
'indeks_lokalitas' => 0.5,
|
||||
'asumsi_prasarana' => 0.5,
|
||||
'is_active' => true,
|
||||
'notes' => 'Parameter untuk usaha besar (non-mikro)'
|
||||
],
|
||||
|
||||
// Hunian Sederhana < 100 m2
|
||||
[
|
||||
'building_function_code' => 'HUNIAN_KECIL',
|
||||
'fungsi_bangunan' => 0.15,
|
||||
'ip_permanen' => 0.4,
|
||||
'ip_kompleksitas' => 0.3,
|
||||
'indeks_lokalitas' => 0.4,
|
||||
'asumsi_prasarana' => 0.5,
|
||||
'is_active' => true,
|
||||
'notes' => 'Parameter untuk hunian sederhana < 100 m2'
|
||||
],
|
||||
|
||||
// Hunian Sederhana > 100 m2
|
||||
[
|
||||
'building_function_code' => 'HUNIAN_BESAR',
|
||||
'fungsi_bangunan' => 0.17,
|
||||
'ip_permanen' => 0.4,
|
||||
'ip_kompleksitas' => 0.6,
|
||||
'indeks_lokalitas' => 0.4,
|
||||
'asumsi_prasarana' => 0.5,
|
||||
'is_active' => true,
|
||||
'notes' => 'Parameter untuk hunian sederhana > 100 m2'
|
||||
],
|
||||
|
||||
// MBR (Masyarakat Berpenghasilan Rendah)
|
||||
[
|
||||
'building_function_code' => 'HUNIAN_MBR',
|
||||
'fungsi_bangunan' => 0,
|
||||
'ip_permanen' => 0,
|
||||
'ip_kompleksitas' => 0,
|
||||
'indeks_lokalitas' => 0,
|
||||
'asumsi_prasarana' => 0.5,
|
||||
'is_active' => true,
|
||||
'notes' => 'Parameter untuk MBR (tarif lebih rendah)'
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($parameters as $parameterData) {
|
||||
$buildingFunction = BuildingFunction::where('code', $parameterData['building_function_code'])->first();
|
||||
|
||||
if ($buildingFunction) {
|
||||
// Remove building_function_code from parameter data
|
||||
$parameterData['building_function_id'] = $buildingFunction->id;
|
||||
unset($parameterData['building_function_code']);
|
||||
|
||||
BuildingFunctionParameter::updateOrCreate(
|
||||
['building_function_id' => $buildingFunction->id],
|
||||
$parameterData
|
||||
);
|
||||
|
||||
$this->command->info("Created/Updated parameter for: {$buildingFunction->name}");
|
||||
} else {
|
||||
$this->command->warn("Building function not found: {$parameterData['building_function_code']}");
|
||||
}
|
||||
}
|
||||
|
||||
$this->command->info('Building Function Parameters seeding completed!');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user