update retribution calculation spatial plannings
This commit is contained in:
73
app/Models/BuildingFunctionParameter.php
Normal file
73
app/Models/BuildingFunctionParameter.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class BuildingFunctionParameter extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'building_function_id',
|
||||
'fungsi_bangunan',
|
||||
'ip_permanen',
|
||||
'ip_kompleksitas',
|
||||
'ip_ketinggian',
|
||||
'indeks_lokalitas',
|
||||
'is_active',
|
||||
'notes'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'fungsi_bangunan' => 'decimal:6',
|
||||
'ip_permanen' => 'decimal:6',
|
||||
'ip_kompleksitas' => 'decimal:6',
|
||||
'ip_ketinggian' => 'decimal:6',
|
||||
'indeks_lokalitas' => 'decimal:6',
|
||||
'is_active' => 'boolean'
|
||||
];
|
||||
|
||||
/**
|
||||
* Building function relationship (1:1)
|
||||
*/
|
||||
public function buildingFunction(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(BuildingFunction::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope: Active parameters only
|
||||
*/
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('is_active', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all parameter values as array
|
||||
*/
|
||||
public function getParametersArray(): array
|
||||
{
|
||||
return [
|
||||
'fungsi_bangunan' => $this->fungsi_bangunan,
|
||||
'ip_permanen' => $this->ip_permanen,
|
||||
'ip_kompleksitas' => $this->ip_kompleksitas,
|
||||
'ip_ketinggian' => $this->ip_ketinggian,
|
||||
'indeks_lokalitas' => $this->indeks_lokalitas
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get formatted parameters for display
|
||||
*/
|
||||
public function getFormattedParameters(): array
|
||||
{
|
||||
return [
|
||||
'Fungsi Bangunan' => $this->fungsi_bangunan,
|
||||
'IP Permanen' => $this->ip_permanen,
|
||||
'IP Kompleksitas' => $this->ip_kompleksitas,
|
||||
'IP Ketinggian' => $this->ip_ketinggian,
|
||||
'Indeks Lokalitas' => $this->indeks_lokalitas . '%'
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user